Skip to content

Commit 25760e4

Browse files
🎉 Source Chargebee: add event model stream(#10143)
* feat(chargebee): add event model * fix(airbyte): update version Dockerfile * docs(chargebee): update changelog * bump connector version * correct source seed Co-authored-by: Marcos Marx <[email protected]>
1 parent 3c5221d commit 25760e4

File tree

9 files changed

+114
-7
lines changed

9 files changed

+114
-7
lines changed

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/686473f1-76d9-4994-9cc7-9b13da46147c.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "686473f1-76d9-4994-9cc7-9b13da46147c",
33
"name": "Chargebee",
44
"dockerRepository": "airbyte/source-chargebee",
5-
"dockerImageTag": "0.1.4",
5+
"dockerImageTag": "0.1.6",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/chargebee",
77
"icon": "chargebee.svg"
88
}

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
- name: Chargebee
113113
sourceDefinitionId: 686473f1-76d9-4994-9cc7-9b13da46147c
114114
dockerRepository: airbyte/source-chargebee
115-
dockerImageTag: 0.1.5
115+
dockerImageTag: 0.1.6
116116
documentationUrl: https://docs.airbyte.io/integrations/sources/chargebee
117117
icon: chargebee.svg
118118
sourceType: api

airbyte-config/init/src/main/resources/seed/source_specs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@
952952
supportsNormalization: false
953953
supportsDBT: false
954954
supported_destination_sync_modes: []
955-
- dockerImage: "airbyte/source-chargebee:0.1.5"
955+
- dockerImage: "airbyte/source-chargebee:0.1.6"
956956
spec:
957957
documentationUrl: "https://apidocs.chargebee.com/docs/api"
958958
connectionSpecification:

airbyte-integrations/connectors/source-chargebee/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ RUN pip install .
1313

1414
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1515

16-
LABEL io.airbyte.version=0.1.5
16+
LABEL io.airbyte.version=0.1.6
1717
LABEL io.airbyte.name=airbyte/source-chargebee

airbyte-integrations/connectors/source-chargebee/integration_tests/configured_catalog.json

+13
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@
103103
"sync_mode": "incremental",
104104
"destination_sync_mode": "append",
105105
"cursor_field": ["updated_at"]
106+
},
107+
{
108+
"stream": {
109+
"name": "event",
110+
"json_schema": {},
111+
"supported_sync_modes": ["full_refresh", "incremental"],
112+
"source_defined_cursor": true,
113+
"default_cursor_field": ["occurred_at"],
114+
"source_defined_primary_key": [["id"]]
115+
},
116+
"sync_mode": "incremental",
117+
"destination_sync_mode": "append",
118+
"cursor_field": ["occurred_at"]
106119
}
107120
]
108121
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"name": "Item",
4+
"type": "object",
5+
"properties": {
6+
"id": {
7+
"type": ["string", "null"],
8+
"maxLength": 40
9+
},
10+
"occurred_at": {
11+
"type": ["integer", "null"]
12+
},
13+
"source": {
14+
"type": ["string", "null"],
15+
"enum": [
16+
"admin_console",
17+
"api",
18+
"scheduled_job",
19+
"hosted_page",
20+
"portal",
21+
"system",
22+
"none",
23+
"js_api",
24+
"migration",
25+
"bulk_operation",
26+
"external_service"
27+
]
28+
},
29+
"user": {
30+
"type": ["string", "null"],
31+
"maxLength": 150
32+
},
33+
"event_type": {
34+
"type": ["string", "null"]
35+
},
36+
"api_version": {
37+
"type": ["string", "null"],
38+
"enum": ["v1", "v2"]
39+
},
40+
"webhook_status": {
41+
"type": ["string", "null"],
42+
"enum": [
43+
"not_configured",
44+
"scheduled",
45+
"succeeded",
46+
"re_scheduled",
47+
"failed",
48+
"skipped",
49+
"not_applicable"
50+
]
51+
},
52+
"content": {
53+
"type": ["object", "null"]
54+
},
55+
"webhooks": {
56+
"type": ["array", "null"],
57+
"items": {
58+
"type": ["object", "null"],
59+
"properties": {
60+
"id": {
61+
"type": ["string", "null"],
62+
"maxLength": 40
63+
},
64+
"webhook_status": {
65+
"type": ["string", "null"],
66+
"enum": [
67+
"not_configured",
68+
"scheduled",
69+
"succeeded",
70+
"re_scheduled",
71+
"failed",
72+
"skipped",
73+
"not_applicable"
74+
]
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}

airbyte-integrations/connectors/source-chargebee/source_chargebee/source.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from airbyte_cdk.sources import AbstractSource
1010
from airbyte_cdk.sources.streams import Stream
1111

12-
from .streams import Addon, AttachedItem, Customer, Invoice, Item, ItemPrice, Order, Plan, Subscription
12+
from .streams import Addon, AttachedItem, Customer, Event, Invoice, Item, ItemPrice, Order, Plan, Subscription
1313

1414

1515
class SourceChargebee(AbstractSource):
@@ -35,6 +35,7 @@ def streams(self, config) -> List[Stream]:
3535
# Below streams are suitable for both `Product Catalog 1.0` and `Product Catalog 2.0`.
3636
common_streams = [
3737
Customer(**kwargs),
38+
Event(**kwargs),
3839
Invoice(**kwargs),
3940
Order(**kwargs),
4041
Subscription(**kwargs),

airbyte-integrations/connectors/source-chargebee/source_chargebee/streams.py

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from chargebee.models import Addon as AddonModel
1414
from chargebee.models import AttachedItem as AttachedItemModel
1515
from chargebee.models import Customer as CustomerModel
16+
from chargebee.models import Event as EventModel
1617
from chargebee.models import Invoice as InvoiceModel
1718
from chargebee.models import Item as ItemModel
1819
from chargebee.models import ItemPrice as ItemPriceModel
@@ -276,3 +277,13 @@ def _send_request(
276277
"""
277278
params = self.request_params(stream_state=stream_state, stream_slice=stream_slice, next_page_token=next_page_token)
278279
return self.api.list(id=stream_slice["item_id"], params=params)
280+
281+
282+
class Event(IncrementalChargebeeStream):
283+
"""
284+
API docs: https://apidocs.eu.chargebee.com/docs/api/events?prod_cat_ver=2#list_events
285+
"""
286+
287+
cursor_field = "occurred_at"
288+
289+
api = EventModel

docs/integrations/sources/chargebee.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ This connector outputs the following streams:
2525
Some streams may depend on Product Catalog version and be accessible only on sites with specific Product Catalog version. This means that we have following streams:
2626

2727
1. presented in both `Product Catalog 1.0` and `Product Catalog 2.0`:
28-
* Subscriptions
2928
* Customers
29+
* Events
3030
* Invoices
3131
* Orders
32+
* Subscriptions
3233
2. presented only in `Product Catalog 1.0`:
3334
* Plans
3435
* Addons
@@ -37,7 +38,7 @@ Some streams may depend on Product Catalog version and be accessible only on sit
3738
* Item Prices
3839
* Attached Items
3940

40-
Also, 8 streams from the above 9 incremental streams are pure incremental meaning that they:
41+
Also, 9 streams from the above 10 incremental streams are pure incremental meaning that they:
4142

4243
* read only new records;
4344
* output only new records.
@@ -81,6 +82,7 @@ Log into Chargebee and then generate an [API Key](https://apidocs.chargebee.com/
8182

8283
| Version | Date | Pull Request | Subject |
8384
| :--- | :--- | :--- | :--- |
85+
| 0.1.6 | 2022-02-10 | [10143](https://github.com/airbytehq/airbyte/pull/10143) | Add support for Event stream |
8486
| 0.1.5 | 2021-12-23 | [8434](https://github.com/airbytehq/airbyte/pull/8434) | Update fields in source-connectors specifications |
8587
| 0.1.4 | 2021-09-27 | [6454](https://github.com/airbytehq/airbyte/pull/6454) | Fix examples in spec file |
8688
| 0.1.3 | 2021-08-17 | [5421](https://github.com/airbytehq/airbyte/pull/5421) | Add support for "Product Catalog 2.0" specific streams: `Items`, `Item prices` and `Attached Items` |

0 commit comments

Comments
 (0)