Metadata-Version: 2.4
Name: gwsoap
Version: 1.0.3
Summary: Auto-generated Python client for the GroupWise SOAP API
License: MIT
Project-URL: Homepage, https://github.com/rhulha/GWSoapApiClientGenerator
Project-URL: Documentation, https://github.com/rhulha/GWSoapApiClientGenerator#readme
Project-URL: Repository, https://github.com/rhulha/GWSoapApiClientGenerator
Project-URL: Bug Reports, https://github.com/rhulha/GWSoapApiClientGenerator/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# GroupWise Python Client

Auto-generated Python package for the GroupWise WSDL/XSD schemas.

Generation code: https://github.com/rhulha/GWSoapApiClientGenerator

## Usage

```python
import sys
import config
from gwsoap.service.groupwise_client import GroupWiseClient
from gwsoap.methods.LoginRequest import LoginRequest
from gwsoap.methods.LogoutRequest import LogoutRequest
from gwsoap.methods.GetFolderListRequest import GetFolderListRequest
from gwsoap.methods.GetItemsRequest import GetItemsRequest
from gwsoap.types.PlainText import PlainText
from gwsoap.soap.request_context import RequestContext
from gwsoap.soap.exceptions import SoapFaultException

try:
    client = GroupWiseClient(config.GW_SOAP_URL)

    print(f"Connecting to {config.GW_SOAP_URL} as {config.GW_USER} …")
    login_req = LoginRequest(
        auth=PlainText(username=config.GW_USER, password=config.GW_PASSWORD),
        application="GWSoapDemo",
        language="en",
    )
    login_resp = client.login(login_req)

    session = login_resp.session
    print(f"  Version : {login_resp.gw_version}  build {login_resp.build}")
    if login_resp.userinfo:
        ui = login_resp.userinfo
        print(f"  user.name    : {ui.name}")
        print(f"  user.email    : {ui.email}")
        print(f"  user.uuid    : {ui.uuid}")
        print(f"  user.recip_type    : {ui.recip_type}")
        

    ctx = RequestContext(session_id=session)

    print("\nTop-level folders:")
    folder_resp = client.get_folder_list(GetFolderListRequest(parent="folders", recurse=False), ctx)
    folders = folder_resp.folders.folder if folder_resp.folders else []
    if folders:
        for f in folders:
            fid   = f.id
            fname = f.name or f.display_name
            ftype = type(f).__name__
            print(f"  [{ftype}]  {fname}  (id={fid})")

    print("\nFirst 10 items in mailbox:")
    items_resp = client.get_items(GetItemsRequest(container="mailbox", count=10), ctx)
    items = items_resp.items.item if items_resp.items else []
    if items:
        for item in items:
            iid      = item.id
            subject  = item.subject
            itype    = type(item).__name__
            print(f"  [{itype}] {subject!r}  id={iid}")

    client.logout(LogoutRequest(), ctx)
    print("Done.")

except SoapFaultException as e:
    print(f"SOAP Fault: {e.faultcode} - {e.faultstring}")
    

```

