Skip to content

Commit 04056d1

Browse files
committed
source-intercom-native: update to use SnapshotResource
Updates the connector to use the new `SnapshotResource` class and `tombstone` default, mostly as an example of how to use them & proof that they work.
1 parent 2d033a5 commit 04056d1

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

source-intercom-native/source_intercom_native/resources.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def validate_credentials(
9494

9595
def full_refresh_resources(
9696
log: Logger, http: HTTPMixin, config: EndpointConfig
97-
) -> list[common.Resource]:
97+
) -> list[common.SnapshotResource]:
9898

9999
def open(
100100
path: str,
@@ -119,16 +119,13 @@ def open(
119119
query_param,
120120
config.advanced.api_version,
121121
),
122-
tombstone=IntercomResource(_meta=IntercomResource.Meta(op="d"))
123122
)
124123

125124
resources = [
126-
common.Resource(
125+
common.SnapshotResource(
127126
name=name,
128-
key=["/_meta/row_id"],
129-
model=IntercomResource,
127+
model=common.BaseDocument,
130128
open=functools.partial(open, path, response_field, query_param),
131-
initial_state=ResourceState(),
132129
initial_config=ResourceConfig(
133130
name=name, interval=timedelta(minutes=5)
134131
),

source-intercom-native/tests/snapshots/snapshots__discover__capture.stdout.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@
3131
"type": "object"
3232
}
3333
},
34-
"additionalProperties": true,
3534
"properties": {
3635
"_meta": {
3736
"$ref": "#/$defs/Meta",
3837
"description": "Document metadata"
3938
}
4039
},
41-
"title": "IntercomResource",
40+
"title": "BaseDocument",
4241
"type": "object",
4342
"x-infer-schema": true
4443
},
@@ -78,14 +77,13 @@
7877
"type": "object"
7978
}
8079
},
81-
"additionalProperties": true,
8280
"properties": {
8381
"_meta": {
8482
"$ref": "#/$defs/Meta",
8583
"description": "Document metadata"
8684
}
8785
},
88-
"title": "IntercomResource",
86+
"title": "BaseDocument",
8987
"type": "object",
9088
"x-infer-schema": true
9189
},
@@ -125,14 +123,13 @@
125123
"type": "object"
126124
}
127125
},
128-
"additionalProperties": true,
129126
"properties": {
130127
"_meta": {
131128
"$ref": "#/$defs/Meta",
132129
"description": "Document metadata"
133130
}
134131
},
135-
"title": "IntercomResource",
132+
"title": "BaseDocument",
136133
"type": "object",
137134
"x-infer-schema": true
138135
},
@@ -172,14 +169,13 @@
172169
"type": "object"
173170
}
174171
},
175-
"additionalProperties": true,
176172
"properties": {
177173
"_meta": {
178174
"$ref": "#/$defs/Meta",
179175
"description": "Document metadata"
180176
}
181177
},
182-
"title": "IntercomResource",
178+
"title": "BaseDocument",
183179
"type": "object",
184180
"x-infer-schema": true
185181
},
@@ -219,14 +215,13 @@
219215
"type": "object"
220216
}
221217
},
222-
"additionalProperties": true,
223218
"properties": {
224219
"_meta": {
225220
"$ref": "#/$defs/Meta",
226221
"description": "Document metadata"
227222
}
228223
},
229-
"title": "IntercomResource",
224+
"title": "BaseDocument",
230225
"type": "object",
231226
"x-infer-schema": true
232227
},
@@ -266,14 +261,13 @@
266261
"type": "object"
267262
}
268263
},
269-
"additionalProperties": true,
270264
"properties": {
271265
"_meta": {
272266
"$ref": "#/$defs/Meta",
273267
"description": "Document metadata"
274268
}
275269
},
276-
"title": "IntercomResource",
270+
"title": "BaseDocument",
277271
"type": "object",
278272
"x-infer-schema": true
279273
},

0 commit comments

Comments
 (0)