Skip to content

Commit 7558adf

Browse files
authored
Source mailersend: Migrate to manifest-only (#44766)
1 parent 22f2d6b commit 7558adf

File tree

15 files changed

+225
-1757
lines changed

15 files changed

+225
-1757
lines changed

airbyte-integrations/connectors/source-mailersend/README.md

+27-53
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,63 @@
11
# Mailersend source connector
22

3+
This directory contains the manifest-only connector for `source-mailersend`.
4+
This _manifest-only_ connector is not a Python package on its own, as it runs inside of the base `source-declarative-manifest` image.
35

4-
This is the repository for the Mailersend source connector, written in Python.
5-
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/mailersend).
6+
For information about how to configure and use this connector within Airbyte, see [the connector's full documentation](https://docs.airbyte.com/integrations/sources/mailersend).
67

78
## Local development
89

9-
### Prerequisites
10-
* Python (~=3.9)
11-
* Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
10+
We recommend using the Connector Builder to edit this connector.
11+
Using either Airbyte Cloud or your local Airbyte OSS instance, navigate to the **Builder** tab and select **Import a YAML**.
12+
Then select the connector's `manifest.yaml` file to load the connector into the Builder. You're now ready to make changes to the connector!
1213

14+
If you prefer to develop locally, you can follow the instructions below.
1315

14-
### Installing the connector
15-
From this connector directory, run:
16-
```bash
17-
poetry install --with dev
18-
```
19-
20-
21-
### Create credentials
22-
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/mailersend)
23-
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_mailersend/spec.yaml` file.
24-
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
25-
See `sample_files/sample_config.json` for a sample config file.
26-
27-
28-
### Locally running the connector
29-
```
30-
poetry run source-mailersend spec
31-
poetry run source-mailersend check --config secrets/config.json
32-
poetry run source-mailersend discover --config secrets/config.json
33-
poetry run source-mailersend read --config secrets/config.json --catalog sample_files/configured_catalog.json
34-
```
16+
### Building the docker image
3517

36-
### Running unit tests
37-
To run unit tests locally, from the connector directory run:
38-
```
39-
poetry run pytest unit_tests
40-
```
18+
You can build any manifest-only connector with `airbyte-ci`:
4119

42-
### Building the docker image
4320
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
4421
2. Run the following command to build the docker image:
22+
4523
```bash
4624
airbyte-ci connectors --name=source-mailersend build
4725
```
4826

4927
An image will be available on your host with the tag `airbyte/source-mailersend:dev`.
5028

29+
### Creating credentials
30+
31+
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/mailersend)
32+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `spec` object in the connector's `manifest.yaml` file.
33+
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
5134

5235
### Running as a docker container
53-
Then run any of the connector commands as follows:
54-
```
36+
37+
Then run any of the standard source connector commands:
38+
39+
```bash
5540
docker run --rm airbyte/source-mailersend:dev spec
5641
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-mailersend:dev check --config /secrets/config.json
5742
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-mailersend:dev discover --config /secrets/config.json
5843
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-mailersend:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
5944
```
6045

61-
### Running our CI test suite
62-
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
63-
```bash
64-
airbyte-ci connectors --name=source-mailersend test
65-
```
46+
### Running the CI test suite
6647

67-
### Customizing acceptance Tests
68-
Customize `acceptance-test-config.yml` file to configure acceptance tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
69-
If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
48+
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
7049

71-
### Dependency Management
72-
All of your dependencies should be managed via Poetry.
73-
To add a new dependency, run:
7450
```bash
75-
poetry add <package-name>
51+
airbyte-ci connectors --name=source-mailersend test
7652
```
7753

78-
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
79-
8054
## Publishing a new version of the connector
81-
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
82-
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-mailersend test`
83-
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
55+
56+
If you want to contribute changes to `source-mailersend`, here's how you can do that:
57+
1. Make your changes locally, or load the connector's manifest into Connector Builder and make changes there.
58+
2. Make sure your changes are passing our test suite with `airbyte-ci connectors --name=source-mailersend test`
59+
3. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
8460
- bump the `dockerImageTag` value in in `metadata.yaml`
85-
- bump the `version` value in `pyproject.toml`
86-
3. Make sure the `metadata.yaml` content is up to date.
8761
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/mailersend.md`).
8862
5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
8963
6. Pat yourself on the back for being an awesome contributor.

airbyte-integrations/connectors/source-mailersend/__init__.py

-3
This file was deleted.

airbyte-integrations/connectors/source-mailersend/acceptance-test-config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ connector_image: airbyte/source-mailersend:dev
44
acceptance_tests:
55
spec:
66
tests:
7-
- spec_path: "source_mailersend/spec.yaml"
7+
- spec_path: "manifest.yaml"
88
connection:
99
tests:
1010
- config_path: "secrets/config.json"

airbyte-integrations/connectors/source-mailersend/main.py

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
version: 4.5.4
2+
3+
type: DeclarativeSource
4+
5+
check:
6+
type: CheckStream
7+
stream_names:
8+
- activity
9+
10+
definitions:
11+
streams:
12+
activity:
13+
type: DeclarativeStream
14+
name: activity
15+
primary_key:
16+
- id
17+
retriever:
18+
type: SimpleRetriever
19+
requester:
20+
$ref: "#/definitions/base_requester"
21+
path: /activity/{{ config['domain_id'] }}
22+
http_method: GET
23+
request_parameters:
24+
limit: "100"
25+
record_selector:
26+
type: RecordSelector
27+
extractor:
28+
type: DpathExtractor
29+
field_path:
30+
- data
31+
paginator:
32+
type: DefaultPaginator
33+
page_token_option:
34+
type: RequestOption
35+
inject_into: request_parameter
36+
field_name: page
37+
page_size_option:
38+
type: RequestOption
39+
inject_into: request_parameter
40+
field_name: page_size
41+
pagination_strategy:
42+
type: PageIncrement
43+
page_size: 100
44+
incremental_sync:
45+
type: DatetimeBasedCursor
46+
cursor_field: created_at
47+
cursor_datetime_formats:
48+
- "%s"
49+
datetime_format: "%s"
50+
start_datetime:
51+
type: MinMaxDatetime
52+
datetime: "{{ config['start_date'] }}"
53+
datetime_format: "%s"
54+
start_time_option:
55+
type: RequestOption
56+
field_name: date_from
57+
inject_into: request_parameter
58+
end_datetime:
59+
type: MinMaxDatetime
60+
datetime: "{{ now_utc().strftime('%s') }}"
61+
datetime_format: "%s"
62+
step: P1D
63+
cursor_granularity: PT1S
64+
schema_loader:
65+
type: InlineSchemaLoader
66+
schema:
67+
$ref: "#/schemas/activity"
68+
base_requester:
69+
type: HttpRequester
70+
url_base: https://api.mailersend.com/v1
71+
authenticator:
72+
type: BearerAuthenticator
73+
api_token: '{{ config["api_token"] }}'
74+
75+
streams:
76+
- $ref: "#/definitions/streams/activity"
77+
78+
spec:
79+
type: Spec
80+
connection_specification:
81+
type: object
82+
$schema: http://json-schema.org/draft-07/schema#
83+
required:
84+
- api_token
85+
- domain_id
86+
properties:
87+
api_token:
88+
type: string
89+
description: >-
90+
Your API Token. See <a
91+
href="https://www.mailersend.com/help/managing-api-tokens">here</a>.
92+
airbyte_secret: true
93+
order: 0
94+
domain_id:
95+
type: string
96+
description: The domain entity in mailersend
97+
examples:
98+
- airbyte.com
99+
- linkana.com
100+
order: 1
101+
start_date:
102+
type: number
103+
description: Timestamp is assumed to be UTC.
104+
examples:
105+
- 123131321
106+
title: "1668311800"
107+
order: 2
108+
additionalProperties: true
109+
110+
metadata:
111+
autoImportSchema:
112+
activity: false
113+
testedStreams: {}
114+
assist: {}
115+
116+
schemas:
117+
activity:
118+
type: object
119+
$schema: http://json-schema.org/draft-07/schema#
120+
additionalProperties: true
121+
properties:
122+
type:
123+
type:
124+
- string
125+
created_at:
126+
type:
127+
- string
128+
format: date-time
129+
email:
130+
type:
131+
- object
132+
properties:
133+
created_at:
134+
type:
135+
- string
136+
format: date-time
137+
from:
138+
type:
139+
- string
140+
html:
141+
type:
142+
- "null"
143+
- string
144+
id:
145+
type:
146+
- string
147+
recipient:
148+
type:
149+
- object
150+
properties:
151+
created_at:
152+
type:
153+
- string
154+
format: date-time
155+
deleted_at:
156+
type:
157+
- string
158+
email:
159+
type:
160+
- string
161+
id:
162+
type:
163+
- string
164+
updated_at:
165+
type:
166+
- string
167+
format: date-time
168+
status:
169+
type:
170+
- string
171+
subject:
172+
type:
173+
- string
174+
tags:
175+
type:
176+
- "null"
177+
- string
178+
text:
179+
type:
180+
- "null"
181+
- string
182+
updated_at:
183+
type:
184+
- string
185+
format: date-time
186+
id:
187+
type:
188+
- string
189+
updated_at:
190+
type:
191+
- string
192+
format: date-time

airbyte-integrations/connectors/source-mailersend/metadata.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ data:
22
connectorSubtype: api
33
connectorType: source
44
definitionId: 2707d529-3c04-46eb-9c7e-40d4038df6f7
5-
dockerImageTag: 0.1.15
5+
dockerImageTag: 0.2.0
66
dockerRepository: airbyte/source-mailersend
77
githubIssueLabel: source-mailersend
88
icon: mailersend.svg
99
license: MIT
1010
name: MailerSend
1111
remoteRegistries:
1212
pypi:
13-
enabled: true
13+
enabled: false
1414
packageName: airbyte-source-mailersend
1515
registryOverrides:
1616
cloud:
@@ -20,8 +20,8 @@ data:
2020
releaseStage: alpha
2121
documentationUrl: https://docs.airbyte.com/integrations/sources/mailersend
2222
tags:
23-
- language:python
2423
- cdk:low-code
24+
- language:manifest-only
2525
ab_internal:
2626
sl: 100
2727
ql: 100
@@ -38,5 +38,5 @@ data:
3838
# type: GSM
3939
# alias: airbyte-connector-testing-secret-store
4040
connectorBuildOptions:
41-
baseImage: docker.io/airbyte/python-connector-base:2.0.0@sha256:c44839ba84406116e8ba68722a0f30e8f6e7056c726f447681bb9e9ece8bd916
41+
baseImage: docker.io/airbyte/source-declarative-manifest:4.5.4@sha256:b07a521add11f987c63c0db68c1b57e90bec0c985f1cb6f3c5a1940cde628a70
4242
metadataSpecVersion: "1.0"

0 commit comments

Comments
 (0)