# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['regrws', 'regrws.api', 'regrws.models']

package_data = \
{'': ['*']}

install_requires = \
['certifi>=2025.0.0,<2026.0.0',
 'pydantic-xml==1.0.0',
 'pydantic[dotenv]>=1.10.22,<2.0.0',
 'requests>=2.28.1,<3.0.0']

setup_kwargs = {
    'name': 'pyregrws',
    'version': '0.2.2',
    'description': "Python library to retrieve and modify records within ARIN's database through their Reg-RWS service",
    'long_description': '# pyregrws\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/jsenecal/pyregrws/ci.yml?label=CI&style=for-the-badge)](https://github.com/jsenecal/pyregrws/actions/workflows/ci.yml)[![PyPI](https://img.shields.io/pypi/v/pyregrws?style=for-the-badge)](https://pypi.org/project/pyregrws/)[![Codecov](https://img.shields.io/codecov/c/github/jsenecal/pyregrws?style=for-the-badge)](https://codecov.io/github/jsenecal/pyregrws)\n\nA Python library for interacting with ARIN\'s Reg-RWS (Registry RESTful Web Service) API. This library provides pydantic-xml models for ARIN payloads and a comprehensive REST client for CRUD operations on ARIN resources like POCs, Customers, Organizations, and Networks.\n\n## Features\n\n- **Type-safe models**: Built with pydantic-xml for robust XML serialization/deserialization\n- **Complete CRUD operations**: Create, read, update, and delete ARIN resources\n- **Automatic manager integration**: Each model type has an associated manager for API operations\n- **Error handling**: Built-in error response handling with proper HTTP status code mapping\n- **Environment configuration**: Configurable via environment variables with sensible defaults\n\n## Installation\n\nInstall from PyPI using pip:\n\n```bash\npip install pyregrws\n```\n\nOr using poetry:\n\n```bash\npoetry add pyregrws\n```\n\n## Quick Start\n\n```python\nfrom regrws.api.core import Api\nfrom regrws.models import Poc, Org, Net, Customer\n\n# Initialize the API client\napi = Api(\n    base_url="https://reg.arin.net/rws",  # Optional, defaults to ARIN production\n    api_key="your-api-key-here"           # Or set REGRWS_API_KEY env var\n)\n\n# Retrieve a POC by handle\npoc = api.poc.from_handle("EXAMPLE-ARIN")\nprint(f"POC: {poc.first_name} {poc.last_name}")\n\n# Create a new POC\nnew_poc = api.poc.create(\n    contact_type="PERSON",\n    first_name="John",\n    last_name="Doe",\n    company_name="Example Corp",\n    iso3166_1={"name": "United States", "code2": "US", "code3": "USA", "e164": "1"},\n    street_address=[{"line": "123 Main St"}],\n    city="Anytown",\n    iso3166_2="VA",\n    postal_code="12345",\n    phones=[{"type": {"code": "O"}, "number": "555-123-4567"}]\n)\n\n# Update and save changes\npoc.city = "New City"\nupdated_poc = poc.save()\n\n# Delete a resource\npoc.delete()\n```\n\n## Configuration\n\nThe library can be configured via environment variables or by passing parameters directly to the `Api` class:\n\n### Environment Variables\n\n- `REGRWS_BASE_URL`: Base URL for the ARIN Reg-RWS API (default: `https://reg.arin.net/rws`)\n- `REGRWS_API_KEY`: Your ARIN API key (required)\n\n### Direct Configuration\n\n```python\nfrom regrws.api.core import Api\nfrom regrws.settings import Settings\n\n# Method 1: Pass parameters directly\napi = Api(\n    base_url="https://reg.arin.net/rws",\n    api_key="your-api-key"\n)\n\n# Method 2: Use Settings object\nsettings = Settings(\n    base_url="https://reg.arin.net/rws",\n    api_key="your-api-key"\n)\napi = Api(settings=settings)\n```\n\n## API Reference\n\n### Core Classes\n\n#### Api\n\nThe main entry point for the library. Automatically creates manager instances for each supported model type.\n\n```python\napi = Api(base_url=None, api_key=None, settings=None)\n```\n\n**Attributes:**\n- `poc`: Manager for POC operations\n- `org`: Manager for Organization operations  \n- `net`: Manager for Network operations\n- `customer`: Manager for Customer operations\n\n#### BaseManager\n\nAll model managers inherit from `BaseManager` and provide these methods:\n\n- `create(**kwargs)`: Create a new resource\n- `from_handle(handle)`: Retrieve a resource by handle\n- `save(instance)`: Update an existing resource\n- `delete(instance)`: Delete a resource\n\n### Models\n\nAll models inherit from `BaseModel` which provides:\n\n- `save()`: Save changes to the resource\n- `delete()`: Delete the resource\n- `absolute_url`: Get the full API URL for this resource\n- `manager`: Access to the associated API manager\n\n## Currently Supported Payloads\n\n### Core Resources\n- [POC](https://www.arin.net/resources/manage/regrws/payloads/#poc-payload) - Point of Contact\n- [Customer](https://www.arin.net/resources/manage/regrws/payloads/#customer-payload) - Customer records\n- [ORG](https://www.arin.net/resources/manage/regrws/payloads/#org-payload) - Organization records\n- [NET](https://www.arin.net/resources/manage/regrws/payloads/#net-payload) - Network records\n- [NET Block](https://www.arin.net/resources/manage/regrws/payloads/#net-block-payload) - Network block records\n- [POC Link](https://www.arin.net/resources/manage/regrws/payloads/#poc-link-payload) - POC associations\n\n### Ticketing\n- [Ticketed Request Payload](https://www.arin.net/resources/manage/regrws/payloads/#ticketed-request-payload)\n- [Ticket Payload](https://www.arin.net/resources/manage/regrws/payloads/#ticket-payload)\n\n### Error Handling\n- [Error](https://www.arin.net/resources/manage/regrws/payloads/#error-payload) - API error responses\n\n## Examples\n\n### Working with POCs\n\n```python\n# Retrieve an existing POC\npoc = api.poc.from_handle("EXAMPLE-ARIN")\n\n# Create a new person POC\nperson_poc = api.poc.create(\n    contact_type="PERSON",\n    first_name="Jane",\n    last_name="Smith",\n    company_name="ACME Corp",\n    iso3166_1={"name": "United States", "code2": "US", "code3": "USA", "e164": "1"},\n    street_address=[{"line": "456 Oak Ave"}, {"line": "Suite 100"}],\n    city="Springfield",\n    iso3166_2="IL", \n    postal_code="62701",\n    phones=[\n        {"type": {"code": "O"}, "number": "217-555-0123"},\n        {"type": {"code": "F"}, "number": "217-555-0124"}\n    ],\n    comment=[{"line": "Technical contact for ACME Corp"}]\n)\n\n# Create a role POC\nrole_poc = api.poc.create(\n    contact_type="ROLE",\n    last_name="Network Operations Center",  # Role name goes in last_name\n    company_name="ACME Corp",\n    iso3166_1={"name": "United States", "code2": "US", "code3": "USA", "e164": "1"},\n    street_address=[{"line": "789 Tech Dr"}],\n    city="Austin",\n    iso3166_2="TX",\n    postal_code="78701",\n    phones=[{"type": {"code": "O"}, "number": "512-555-0100"}]\n)\n```\n\n### Working with Organizations\n\n```python\n# Retrieve an organization\norg = api.org.from_handle("EXAMPLE-ARIN")\n\n# Update organization details\norg.company_name = "Updated Company Name"\nupdated_org = org.save()\n```\n\n### Working with Networks\n\n```python\n# Retrieve a network\nnet = api.net.from_handle("NET-192-0-2-0-1")\n\n# Update network information\nnet.net_name = "UPDATED-NET-NAME"\nupdated_net = net.save()\n```\n\n### Error Handling\n\n```python\nfrom regrws.models import Error\n\ntry:\n    poc = api.poc.from_handle("NONEXISTENT-HANDLE")\nexcept Exception as e:\n    # The library automatically handles error responses\n    print(f"Error occurred: {e}")\n```\n\n## Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/jsenecal/pyregrws.git\ncd pyregrws\n\n# Install dependencies\npoetry install\n```\n\n### Running Tests\n\n```bash\n# Run all tests with coverage\npoetry run pytest --cov -n 2 --cov-report xml --cov-report term-missing\n\n# Run a specific test\npoetry run pytest tests/test_api.py::TestAPI::test_manager_from_handle\n```\n\n### Code Quality\n\n```bash\n# Lint code\npoetry run ruff check\n\n# Format code  \npoetry run ruff format\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Add tests for your changes\n5. Ensure all tests pass and code is formatted\n6. Commit your changes (`git commit -m \'Add amazing feature\'`)\n7. Push to the branch (`git push origin feature/amazing-feature`)\n8. Open a Pull Request\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Links\n\n- [ARIN Reg-RWS Documentation](https://www.arin.net/resources/manage/regrws/)\n- [ARIN Reg-RWS Payloads](https://www.arin.net/resources/manage/regrws/payloads/)\n- [PyPI Package](https://pypi.org/project/pyregrws/)\n- [GitHub Repository](https://github.com/jsenecal/pyregrws)\n',
    'author': 'Jonathan Senecal',
    'author_email': 'contact@jonathansenecal.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/jsenecal/pyregrws',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.11,<4.0',
}


setup(**setup_kwargs)
