Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#

import logging
import logging, datetime
from http import HTTPStatus
from itertools import chain
from typing import Any, List, Mapping, Optional, Tuple
Expand Down Expand Up @@ -113,6 +113,17 @@ def get_api(config: Mapping[str, Any]) -> API:

def get_common_params(self, config) -> Mapping[str, Any]:
start_date = config.get("start_date", DEFAULT_START_DATE)

start_date_offset = config.get("relative_start_date_offset", 0)

if start_date_offset > 0:
# set start_Date relative to today
now = datetime.date.today()
delta = datetime.timedelta(days=start_date_offset)
start_date = (now - delta)

print(f"getting config: now: {now} // delta: {delta} // start_date: {start_date}")

credentials = config["credentials"]
api = self.get_api(config=config)
return dict(api=api, start_date=start_date, credentials=credentials)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ connectionSpecification:
examples:
- "2017-01-25T00:00:00Z"
format: date-time
relative_start_date_offset:
title: Relative date offset
type: integer
minimum: 0
maximum: 365
description: >-
Offset relative to current date, measured in whole days (integer between 1 and 365). If this is set, it takes precedence over the set start_date. To
gather data with a moving window fo a week, set this to 7 (days).
examples:
- "7"
credentials:
title: Authentication
description: Choose how to authenticate to HubSpot.
Expand Down