Any and all contributions and involvement with the project is welcome. The easiest way to begin contributing is to check out the open issues on GitHub.
If you want to add new feature, please, create an issue first and describe your idea.
If you want to add new extension for pagination you will need to create a new module in fastapi_pagination/ext/ directory.
Please, use fastapi_pagination/ext/sqlalchemy.py as an example.
Generally, you will need to call function paginate and signature should include next arguments:
fromtypingimportAny,Optionalfromfastapi_pagination.apiimportapply_items_transformer,create_pagefromfastapi_pagination.basesimportAbstractParamsfromfastapi_pagination.typesimportAdditionalData,AsyncItemsTransformerfromfastapi_pagination.utilsimportverify_paramsasyncdefpaginate(query:Any,params:Optional[AbstractParams]=None,# Optional params for pagination (if None, current params will be used)*,transformer:Optional[AsyncItemsTransformer]=None,# Optional transformer for itemsadditional_data:Optional[AdditionalData]=None,# Optional additional data for page object)->Any:params,raw_params=verify_params(params,"limit-offset")# verify params is of correct typetotal=awaitquery.count()# get total count of itemsitems=awaitquery.limit(raw_params.limit).offset(raw_params.offset).all()# get items for current paget_items=awaitapply_items_transformer(items,transformer,async_=True)# apply transformer if neededreturncreate_page(# create page objectt_items,total=total,params=params,**(additional_dataor{}),)
If you want to add/updated docs, then you will need to edit ./docs/ directory.
You can run mkdocs serve to see your changes locally.