Metadata-Version: 2.2
Name: pyWeclapp
Version: 0.0.9
Summary: Provides methods, classes and classbuilders to integrate with the Weclapp API
Home-page: https://github.com/AltruanGmbH/weclappFunctions
Author: Altruan GmbH
Author-email: jakob.goesswald@altruan.de
License: MIT
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: annotated-types==0.6.0
Requires-Dist: attrs==23.1.0
Requires-Dist: certifi==2023.11.17
Requires-Dist: charset-normalizer==3.3.2
Requires-Dist: idna==3.4
Requires-Dist: jsonschema==4.20.0
Requires-Dist: jsonschema-specifications==2023.11.1
Requires-Dist: pydantic==2.5.2
Requires-Dist: pydantic_core==2.14.5
Requires-Dist: pytz==2023.3.post1
Requires-Dist: referencing==0.31.0
Requires-Dist: requests==2.31.0
Requires-Dist: rpds-py==0.13.1
Requires-Dist: typing_extensions==4.8.0
Requires-Dist: urllib3==2.1.0
Provides-Extra: dev
Requires-Dist: twine>=4.0.2; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# pyWeclapp - Methods, classes and class builders for interacting with the weclapp api

This Package contains methods to acess weclapp objects via the api.

## Setup 
#### Step1
```{python}
    # set the weclappDomain to call to to environment variables:
    import os
    os.environ["weclappDomain"] = "yourCompany.weclapp.com"

    # SetAuthentication Token
    # set the authenticationToken obtainable from weclapp via:
    # your Account -> my settings -> API-Token
    # the token should have the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    # set the default token as "Weclapp_AuthenticationToken0" via 
    os.environ["Weclapp_AuthenticationToken0"] = yourToken
```

#### Step2 (optional)
For some applications it is usefull to set multiple tokens from different users. Please index them e.g. "Weclapp_AuthenticationToken1", "Weclapp_AuthenticationToken2"
the Api Key can be referenced in selected functions via it's short name key0 or key1  or ...; key0=default



# weclapp
### Provides basic function for quering the Weclapp API (GET, PUT, POST and DELETE)
You can specify with asType the desired datatype of the response, so that for example the "result" attribte gets removed when asking for e.g. all orders
in these functions will throw a specialized weclappError if they fail.
PUT function uses the query Parmateter "justUsedProperties" by default to allow for updates with only changes


# weclappClasses
### Provides a nested pydantic dataModel for the most used classes with update tracking and metaData handling
to initialise use .fromWeclapp -> e.g. weclappClasses.SalesOrder.fromWeclapp("yourWeclappSalesOrderId")
to retrieve the dictionary again use .getUpdateDict("used+") with updateType:
     "full" -> complete Dict, 
     "used+" -> just changes with version included or 
     "used" -> just changes
to directly Update use .updateWeclapp(), .updateEntity() functions


### Creating Neu class Instances in weclapp
the class also provides you with a template to create an emptyClass. In this case please use the fromBlank() classmethod.
after that all attributes will be set to None, lists or empyt subclasses, that you can modify or append to.
after compleetion call the postNewEntity() method to post it to weclapp. Please do not set "id" or "verion"
#### Example
    salesOrder = weclappClasses.SalesOrder.fromBlank()
    salesOrder.customerId = "1234"  
    salesOrder.invoiceAddress.firstName = "Max"
    salesOrder.qmd("1234", addToMetaData=True).booleanValue = True  # Adds a custom Attribute
    orderItem = weclappClasses.OrderItems.fromBlank()
    orderItem.articleId = "1234"
    salesOrder.orderItems.append(orderItem)
    salesOrder.postNewEntity()

### Createing a new class Template
Sometimes you may want to create a new weclappClass that does not exist yet or update an old one.

#### Setup Example
    from pyWeclapp.weclappClasses.weclappClassBlueprint import weclappClassCreator
    weclappClassCreator.WeclappClassCreator(entityName="ticket", expamleEntityId="74344116", targetDirectory="util/weclappClasses").createPythonFile()

offers a convenient way to do this.
just specify a  entityName -> "salesOrder", "shipment", "contract", "article", "etc."
                expamleEntityId -> to estimate the types
                targetDirectory -> where the generaed files should be placed
                entity -> overwirtes the starting dictionary (Optional)

This will create the templates for the weclappclass as well as a init file.
if you need supproperties make sure the example entity contains example of this. Oherwhise it will only be an enpty list without model
#### CATION may overwrite existing files -> choose an empty directory


# CustomAttributes
when working with customAttribes a way of nameing them is important. However the ids vary form system to system
the CAT classes (CustomATtributes) will generate the a classtemplate like in examples.
ater that the attributes will be accessable with their weclappSystemNames with suggesions
selectableElements will also be parsed. use bracets in description to choose a different system Name e.g.: "this is a selectable - Option (MySelectableOption)" -> Name will be "MySelectableOption"
otherhwise invalid characters will be removed and a "X" will be added if the startincharacter is invalid

#### CAUTION this may overwrite changes you made in your module. 
#### Setup Example
    from pyWeclapp.customAttributes import CAT_Generator
    # specify your wish directory. 
    CAT_Generator(entityName="ticket", entityId="74344116", targetDirectory="util/customAttributes")

#### Usage Example
    from yourTaregtDirectory import CAT
    citty = CAT() # initialises all attributes that are paresed so far
    citty.exampleAttribute.id # "1234"
    citty.exampleAttribute.valueName # selectedValues
    citty.exampleAttribute.MySelectableOption # "5678"

#### if you only need attribtes for specific entity please use the more specific and lightweight subclasses like cat_SalesOrder

# weclappDoc
### allows you to upload, download or modify documents
it autosets a description (DocDescription class) in json format to make documents identifiable via code
### DocManager(entityName, entityId) 
    -> get all documents of a entity: .getDocuments()
    -> Upload a file -> .uploadFile()
    -> download a file -> .getDocumentFiles()

### Document
behaives like a weclapp class -> Document.fromWeclapp()
Allows to:
    -> update -> .updateFile()
    -> download -> .downloadDoc()
    -> set Description -> .setDescription() 
    -> update Description -> .updateDescription()

#### Example
    docManger = pyWeclapp.weclappDoc.DocManager("shipment", "74433425")
    availableDocs = docManger.getDocuments()


# timeFunctions
### higher level functions for working with dates in different formats
optimised for woring with weclapp





create wheel with comand >python3 setup.py bdist_wheel sdist
