def SiteArchiveExport(
        self,
        data_units: dict,
        file_path: str,
        overwrite: bool = False,
        headers: dict = None,
    ) -> Response:
        """Export XML ZIP file.

        This job is for executing a site export to an archive file based on data unit configuration in json format.
        https://documentation.b2c.commercecloud.salesforce.com/DOC1/topic/com.demandware.dochelp/OCAPI/current/data/Documents/SiteArchiveExportConfiguration.html

        Args:
            data_units (dict): Dictionary defining the Export units to export.
            file_path (str): Path to zipfile to export, relative to Impex/src.
            overwrite (bool): Overwrite zipfile in export location. Defaults to False.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}/sfcc-site-archive-import/executions"
        body = {
            "export_file": file_path,
            "data_units": data_units,
            "overwrite_export_file": overwrite,
        }
        return Endpoint.POST(self, url, body=body, headers=headers)
Beispiel #2
0
    def CreateBasket(self, headers=None) -> Response:
        """Create default basket.

        [extended_summary]

        Args:
            headers (dict, optional): Additional headers to inject. Defaults to None.

        Returns:
            Response: Response to request.
        """
        url = f"{self.instance}/s/{self.site}/dw/shop/v20_4/{self.base}"
        return Endpoint.POST(self, url, headers=headers)
    def GetJobExecution(self, body: dict, headers: dict = None, **kwargs) -> Response:
        """Get job execution by Job ID.

        [extended_summary]

        Args:
            body (dict): Dictionary for the POST request body.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}"
        return Endpoint.POST(self, url, body, headers=headers, idempotent=True)
Beispiel #4
0
    def ExecuteJob(self, job_id: str, headers: dict = None) -> Response:
        """Trigger Job Execution information by Job ID.

        [extended_summary]

        Args:
            job_id (str): Job ID to get information about.
            id (str): Execution ID to get information about.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}/{job_id}/executions"
        return Endpoint.POST(self, url, headers=headers)
Beispiel #5
0
    def AddOrderNote(self,
                     order: str,
                     note: dict,
                     headers: dict = {}) -> Response:
        """Get order notes.

        Args:
            order (str): String of the order number.
            note (dict): Refer to Note Request document.

        Returns:
            Response: HTTPX response object
        """
        url = f"{self.instance}/s/{self.site}/dw/shop/v20_4/{self.base}/{order}/notes"
        return Endpoint.POST(self, url=url, body=note, headers=headers)
    def IncrementalContentIndexUpdate(self,
                                      site_scope: str,
                                      headers: dict = None) -> Response:
        """Incremental Content Index Update.

        This job updates all content related search indexes for the given site scope.

        Args:
            site_scope (str): Site scope to re-index.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}/sfcc-search-index-content-incremental-update/executions"
        body = {"site_scope": site_scope}
        return Endpoint.POST(self, url, body=body, headers=headers)
Beispiel #7
0
    def SearchCustomObjects(self,
                            object_type: str,
                            body: dict,
                            headers: dict = None,
                            **kwargs) -> Response:
        """Get Custom Objects by search criteria.

        [extended_summary]

        Args:
            body (dict): Dictionary for the POST request body.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}/{object_type}"
        return Endpoint.POST(self, url, body, headers=headers, idempotent=True)
    def Search(self, body, headers: dict = {}, **kwargs) -> Response:
        """Get Orders by Search query.

        [extended_summary]

        Args:
            body (dict): Dictionary for the POST request body.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """

        url = f"{self.instance}/s/{self.site}/dw/shop/v20_4/{self.base}"
        return Endpoint.POST(self,
                             url=url,
                             body=body,
                             headers=headers,
                             idempotent=True)
    def SiteArchiveImport(self,
                          file_path: str,
                          mode: str = "merge",
                          headers: dict = None) -> Response:
        """Import XML ZIP file.

        This job is for importing a whole site import ZIP file. Note that the file is specified by its simple file name
        and must be already uploaded to the server. You may specify an import mode, where currently only 'merge' is supported.

        Args:
            file_path (str): Path to zipfile to import.
            mode (str): Mode to import XML, merge only supported option at this time.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}/sfcc-site-archive-import/executions"
        body = {"file_name": file_path, "mode": mode}
        return Endpoint.POST(self, url, body=body, headers=headers)
Beispiel #10
0
    def CustomerSearch(
        self,
        body: dict,
        customer_list_id: str,
        headers: dict = None,
        **kwargs,
    ) -> Response:
        """Get customer by search.

        [extended_summary]

        Args:
            body (dict): Dictionary for the POST request body.
            customer_list_id (str): Customer list ID.
            headers (dict, optional): Key value pairs for headers added to request. Defaults to None.

        Returns:
            Response: HTTPX response object.
        """
        url = f"{self.instance}/s/{self.site}/dw/data/v20_4/{self.base}/{customer_list_id}/customer_search"
        return Endpoint.POST(self, url, body, headers=headers, idempotent=True)