Skip to content

Commit

Permalink
Add missing data export methods
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRy4n committed Jul 31, 2023
1 parent aab7589 commit d3d3506
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 10 additions & 0 deletions intercom_python_sdk/apis/data_export/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,13 @@ def export(self, created_before: Union[int, datetime], created_after: Union[int,
@get("/download/content/data/{job_identifier}") # Leading slash as we aren't using the base URI
def download(self, job_identifier: Path("job_identifier", str)): # noqa # type: ignore
""" Download a data export. """

@returns(dexport_schemas.DataExportJobSchema()) # type: ignore
@post("cancel/{job_identifier}")
def cancel(self, job_identifier: Path("job_identifier", str)): # noqa # type: ignore
""" Cancel a data export. """

@returns(dexport_schemas.DataExportJobSchema()) # type: ignore
@post("content/data/{job_identifier}")
def get(self, job_identifier: Path("job_identifier", str)): # noqa # type: ignore
""" Get a data export. """
9 changes: 5 additions & 4 deletions intercom_python_sdk/apis/data_export/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import requests
from typing import (
TYPE_CHECKING,
Optional
)

# From Current Package
Expand Down Expand Up @@ -72,15 +73,15 @@ def download_url(self) -> str:

def update(self, **kwargs) -> 'DataExportJob':
""" Update this data export job to fetch it's current status and values. """
job = self.api_client.get_export_job(job_identifier=self.job_identifier)
self.__update_self(job)
job = self.api_client.get(job_identifier=self.job_identifier)
self.__update_self(job) # type: ignore

return self

def cancel(self) -> 'DataExportJob':
""" Cancel this data export job. """
job = self.api_client.cancel_export_job(job_identifier=self.job_identifier)
self.__update_self(job)
job = self.api_client.cancel(job_identifier=self.job_identifier)
self.__update_self(job) # type: ignore

return self

Expand Down

0 comments on commit d3d3506

Please sign in to comment.