coveo / coveo/push-api-client.py
[Feature Request]: Add a function to call DELETE on documents/olderthan
- Dominant language
- Python
- Stars
- 1
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
### Current Behavior
Coveo has a feature to delete documents that are older than a given date. When doing a full refresh, that endpoint can be called to delete documents that don't exist anymore.
The endpoint documentation: https://docs.coveo.com/en/131/index-content/deleting-old-items-in-a-push-source
The current SDK implementation does not expose this method.
### Expected Behavior
The SDK should expose this method.
### Steps To Reproduce
1. Install the SDK
2. Look for methods available on a Source
3. The method is not there
### Environment
```Markdown
Python Version -> Latest
OS Version -> Latest macOS
...
```
### Debug logs
_No response_
### Anything else?
Here is a bad piece of code I ended up using:
```python
url = (
f"https://api.cloud.coveo.com/push/v1/organizations/{self.organization_id}/sources/{self.source_id}/"
f"documents/olderthan"
)
response = self.source.client.session.delete(
url,
params={"orderingId": self.clear_items_older_than},
headers={"Authorization": f"Bearer {self.coveo_api_key}"},
)
if response.status_code == 202:
logger.info("Old documents deleted successfully.")
else:
logger.error(f"Failed to delete old documents: {response.json()}")
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the SDK's Source entry point and inspect how existing source methods build requests and expose response handling. Add coverage for the documents/olderthan DELETE endpoint, including its orderingId parameter and 202 response, and confirm the method is available on Source.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100