-
Notifications
You must be signed in to change notification settings - Fork 1
Dev #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
fasteiner
wants to merge
21
commits into
main
Choose a base branch
from
Dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Dev #31
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
65e99c7
Add unit tests for OutOfOfficePeriod, Product, ReferencedTypes, Shop,…
fasteiner 53f02c2
Update pyproject.toml for release 0.12.0-preview.1
fasteiner f271145
Update release workflow to use GitVersion v4 and adjust output handling
fasteiner cd0c669
Merge branch 'Dev' of https://github.com/fasteiner/xurrent-python int…
fasteiner 0759d89
Update GitVersion action to v3 in release workflow
fasteiner 5c96bc5
Downgrade GitVersion action to v3 in release workflow
fasteiner df2ca79
Update pyproject.toml for release 0.12.1
fasteiner e7eee8d
updated contributing file
fasteiner 86340d3
Merge branch 'Dev' of https://github.com/fasteiner/xurrent-python int…
fasteiner e6b195b
Update pyproject.toml for release 0.12.2
fasteiner cd35bb1
Add 10 new domain classes: problems, service_instances, releases, pro…
Copilot 3cc3785
Add TypeError for invalid note type in add_note methods
Copilot bd6bb45
Add sub-resource methods to existing domain classes
Copilot 967c975
Add utility API methods to XurrentApiHelper and populate __init__.py …
Copilot 18efde8
Add comprehensive unit tests for new domain classes and sub-resource …
Copilot 84eb028
Add 10 new domain classes, 43 sub-resource methods, 5 utility APIs, 3…
Copilot 94eca1e
Merge pull request #30 from fasteiner/copilot/add-missing-domain-classes
fasteiner 5b82588
Update pyproject.toml for release 0.13.0-preview.10
fasteiner f76ecf4
fix lazy-loaded cross-module annotations
Copilot 9961d9a
fix search encoding and release tag parsing
Copilot b7af646
Update pyproject.toml for release 0.13.0-preview.23
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,7 +164,11 @@ cython_debug/ | |
|
|
||
| # poetry | ||
| poetry.lock | ||
| uv.lock | ||
|
|
||
| # diff files | ||
| *.diff | ||
| diff* | ||
| diff* | ||
|
|
||
| #Claude local | ||
| .claude/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| `xurrent-python` is a Python wrapper for the Xurrent API (a service/incident management platform). It provides object-oriented abstractions over REST endpoints with built-in handling for authentication, pagination, rate limiting, and OAuth token refresh. | ||
|
|
||
| ## Setup | ||
|
|
||
| This project uses [Poetry](https://python-poetry.org/) for dependency management. | ||
|
|
||
| ```bash | ||
| pip install poetry | ||
| poetry install --with dev | ||
| eval $(poetry env activate) | ||
| pre-commit install | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| ### Testing | ||
|
|
||
| ```bash | ||
| # Unit tests (no credentials required) | ||
| pytest ./tests/unit_tests | ||
|
|
||
| # Run a single test file | ||
| pytest ./tests/unit_tests/test_core_oauth.py -v | ||
|
|
||
| # Run a single test function | ||
| pytest ./tests/unit_tests/test_core_oauth.py::test_init_requires_authentication_method -v | ||
|
|
||
| # Doctests in source modules | ||
| pytest ./src/ --doctest-modules -v | ||
|
|
||
| # Integration tests (requires env vars: APITOKEN, APIACCOUNT, APIURL) | ||
| pytest ./tests/integration | ||
| ``` | ||
|
|
||
| Integration tests require a `.env` file or environment variables: `APITOKEN`, `APIACCOUNT`, `APIURL`. | ||
|
|
||
| ### Pre-commit | ||
|
|
||
| ```bash | ||
| pre-commit run --all-files | ||
| ``` | ||
|
|
||
| The pre-commit hook runs the unit test suite automatically before each commit. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Core (`xurrent/core.py`) | ||
|
|
||
| `XurrentApiHelper` is the central HTTP client. It: | ||
| - Supports two auth modes: **API key** (`XurrentApiHelper(token=..., account=..., api_url=...)`) and **OAuth 2.0 client credentials** (`XurrentApiHelper(client_id=..., client_secret=..., account=..., api_url=...)`) | ||
| - Automatically handles pagination via `Link` response headers — callers receive aggregated results | ||
| - Retries on HTTP 429 (rate limit) and refreshes OAuth tokens on HTTP 401 | ||
| - Exposes `api_call(method, url, data, params)` as the low-level HTTP wrapper used by all domain classes | ||
|
|
||
| `JsonSerializableDict` is the base class for all resource models, providing `to_dict()` and `to_json()` serialization. | ||
|
|
||
| ### Domain Classes | ||
|
|
||
| Each module wraps one Xurrent resource type. All domain classes follow the same patterns: | ||
| - Accept a `XurrentApiHelper` instance as `connection_object` | ||
| - Use `@classmethod` factory methods (`get_by_id()`, `get_<resource>()`, `create()`) to deserialize API responses into instances via `from_data()` | ||
| - Expose lifecycle methods (enable/disable/archive/trash/restore) and resource-specific operations | ||
|
|
||
| | Module | Class | Notable Features | | ||
| |---|---|---| | ||
| | `requests.py` | `Request` | Notes, linked CIs, status/category/completion enums | | ||
| | `people.py` | `Person` | `get_me()`, team membership | | ||
| | `configuration_items.py` | `ConfigurationItem` | Auto-increments label on creation | | ||
| | `tasks.py` | `Task` | Approve/reject/cancel, workflow linkage | | ||
| | `workflows.py` | `Workflow` | Close with completion reason | | ||
| | `teams.py` | `Team` | Basic lifecycle management | | ||
|
|
||
| ### Circular Import Handling | ||
|
|
||
| Domain classes cross-reference each other (e.g., `Request` embeds `Person`, `Team`, `Workflow`). To avoid circular imports, these are imported lazily — inside methods rather than at module top level. When adding new cross-module references, follow this same pattern. | ||
|
|
||
| ### Tests | ||
|
|
||
| - **`tests/unit_tests/`** — Uses `MagicMock` to stub `XurrentApiHelper`; no real credentials needed | ||
| - **`tests/integration/`** — Hits a live Xurrent instance; requires credentials in environment | ||
|
|
||
| When adding a new domain class, add corresponding unit tests under `tests/unit_tests/`. | ||
|
|
||
| ## Changelog | ||
|
|
||
| All changes must be documented in [CHANGELOG.md](CHANGELOG.md) under the `[Unreleased]` section, following the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. Use the appropriate subsection (`Added`, `Changed`, `Fixed`, `Removed`) and prefix each entry with the affected module or component (e.g., `Core:`, `Requests:`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.