Skip to content

Commit

Permalink
✨Source Asana: Add OrgnizationExports Stream (#31634)
Browse files Browse the repository at this point in the history
Co-authored-by: Sajarin <sajarindider@gmail.com>
Co-authored-by: sajarin <sajarin@users.noreply.github.com>
  • Loading branch information
3 people committed Oct 24, 2023
1 parent 1336b4e commit 6d01784
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 3 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-asana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.0
LABEL io.airbyte.version=0.3.0
LABEL io.airbyte.name=airbyte/source-asana
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "organization_exports",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "projects",
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-asana/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: d0243522-dccf-4978-8ba0-37ed47a0bdbf
dockerImageTag: 0.2.0
dockerImageTag: 0.3.0
dockerRepository: airbyte/source-asana
documentationUrl: https://docs.airbyte.com/integrations/sources/asana
githubIssueLabel: source-asana
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"type": ["null", "object"],
"properties": {
"gid": {
"type": ["null", "string"]
},
"resource_type": {
"type": ["null", "string"]
},
"created_at": {
"type": ["null", "string"],
"format": "date-time"
},
"download_url": {
"type": ["null", "string"]
},
"state": {
"type": ["null", "string"]
},
"organization": {
"type": ["null", "object"],
"properties": {
"gid": {
"type": ["null", "string"]
},
"resource_type": {
"type": ["null", "string"]
},
"name": {
"type": ["null", "string"]
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Attachments,
AttachmentsCompact,
CustomFields,
OrganizationExports,
Projects,
Sections,
SectionsCompact,
Expand Down Expand Up @@ -57,7 +58,7 @@ def _get_authenticator(config: dict) -> Union[TokenAuthenticator, AsanaOauth2Aut

def streams(self, config: Mapping[str, Any]) -> List[Stream]:
args = {"authenticator": self._get_authenticator(config)}
return [
streams = [
AttachmentsCompact(**args),
Attachments(**args),
CustomFields(**args),
Expand All @@ -72,3 +73,6 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
Users(**args),
Workspaces(**args),
]
if "organization_export_ids" in config:
streams.append(OrganizationExports(organization_export_ids=config.get("organization_export_ids"), **args))
return streams
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
}
}
]
},
"organization_export_ids": {
"title": "Organization Export IDs",
"description": "Globally unique identifiers for the organization exports",
"type": "array"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]:
yield from self.read_slices_from_records(stream_class=Tasks, slice_field="resource_gid")


class OrganizationExports(AsanaStream):
def __init__(self, organization_export_ids: str, **kwargs):
super().__init__(**kwargs)
self._organization_export_ids = organization_export_ids

def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str:
organization_export_gid = stream_slice["organization_export_gid"]
return f"organization_exports/{organization_export_gid}"

def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]:
yield from [{"organization_export_gid": organization_export_id for organization_export_id in self._organization_export_ids}]


class Projects(WorkspaceRequestParamsRelatedStream):
use_cache = True

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/asana.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The connector is restricted by normal Asana [requests limitation](https://develo

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :--------------------------------------------------------- |
| 0.3.0 | 2023-10-24 | [31634](https://github.com/airbytehq/airbyte/pull/31634) | Add OrganizationExports stream |
| 0.2.0 | 2023-10-17 | [31090](https://github.com/airbytehq/airbyte/pull/31090) | Add Attachments stream |
| 0.1.9 | 2023-10-16 | [31089](https://github.com/airbytehq/airbyte/pull/31089) | Add Events stream |
| 0.1.8 | 2023-10-16 | [31009](https://github.com/airbytehq/airbyte/pull/31009) | Add SectionsCompact stream |
Expand Down

0 comments on commit 6d01784

Please sign in to comment.