Lots of changes to get to FastAPI 95.1
This commit is contained in:
@@ -18,7 +18,7 @@ router = APIRouter()
|
||||
@router.get('/aether/cfg/{aether_cfg_id}', response_model=Resp_Body_Base)
|
||||
async def get_aether_cfg_obj(
|
||||
aether_cfg_id: int,
|
||||
# aether_cfg_id: str = Query(..., min_length=1, max_length=22),
|
||||
# aether_cfg_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
commons: Common_Route_Params_No_Account_ID = Depends(common_route_params_no_account_id),
|
||||
@@ -42,7 +42,7 @@ async def get_aether_cfg_obj(
|
||||
@router.get('/aether/flask/cfg/{aether_flask_cfg_id}', response_model=Resp_Body_Base)
|
||||
async def get_aether_flask_cfg_obj(
|
||||
aether_flask_cfg_id: int,
|
||||
# aether_flask_cfg_id: str = Query(..., min_length=1, max_length=22),
|
||||
# aether_flask_cfg_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
# NOTE: The x_account_id header value is not required.
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
|
||||
@@ -31,7 +31,7 @@ router = APIRouter()
|
||||
# Updated 2024-04-25
|
||||
@router.get('/event/{e_confex_event_id}/import_reg', response_model=Resp_Body_Base)
|
||||
async def import_event_session_list(
|
||||
e_confex_event_id: str = Query(..., min_length=5, max_length=22), # For AAPOR: aapor_2023 (2024-05); aapor_2023 (2023-05)
|
||||
e_confex_event_id: str = Path(min_length=5, max_length=22), # For AAPOR: aapor_2023 (2024-05); aapor_2023 (2023-05)
|
||||
|
||||
event_id: str = Path(min_length=11, max_length=22), # For AAPOR: MCz-Qm-48-j1 (1513 2024-05) 9jW-Db-SF-wt (1478 2023-05); x2H2P2MYlXU (1447 2022-05)
|
||||
# Account ID For AAPOR: j5EBhRDqPuw (20)
|
||||
|
||||
@@ -101,7 +101,7 @@ async def process_recent_changes(
|
||||
# Updated 2022-02-02
|
||||
@router.get('/person/{cvent_person_contact_id}', response_model=Resp_Body_Base)
|
||||
async def get_person(
|
||||
cvent_person_contact_id: str = Query(..., min_length=36, max_length=36), # UUID v4; actually the Cvent Contact UUID for a person
|
||||
cvent_person_contact_id: str = Path(min_length=36, max_length=36), # UUID v4; actually the Cvent Contact UUID for a person
|
||||
person_id: str = Query(None, min_length=11, max_length=22),
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
@@ -197,7 +197,7 @@ async def get_person(
|
||||
# Updated 2022-02-02
|
||||
@router.get('/person/email/{email}', response_model=Resp_Body_Base)
|
||||
async def get_person_w_email(
|
||||
email: str = Query(..., min_length=5, max_length=75),
|
||||
email: str = Path(min_length=5, max_length=75),
|
||||
person_id: str = Query(None, min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
@@ -271,7 +271,7 @@ async def get_person_w_email(
|
||||
# Updated 2022-02-02
|
||||
@router.get('/person/external_id/{external_id}', response_model=Resp_Body_Base)
|
||||
async def get_person_w_external_id(
|
||||
external_id: str = Query(..., min_length=10, max_length=100),
|
||||
external_id: str = Path(min_length=10, max_length=100),
|
||||
person_id: str = Query(None, min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
|
||||
@@ -679,7 +679,7 @@ async def event_import_reg(
|
||||
# @router.get('/event/{event_badge_id}/check_individual', response_model=Resp_Body_Base)
|
||||
@router.get('/event/{e_impexium_individual_id}/check_individual', response_model=Resp_Body_Base)
|
||||
async def event_check_individual(
|
||||
e_impexium_individual_id: str = Query(..., min_length=50, max_length=55),
|
||||
e_impexium_individual_id: str = Path(min_length=50, max_length=55),
|
||||
# event_badge_id: str = Query(..., min_length=11, max_length=22),
|
||||
details: bool = False,
|
||||
|
||||
@@ -932,7 +932,7 @@ async def event_check_individual(
|
||||
# Updated 2022-03-22
|
||||
@router.get('/event/{e_impexium_event_id}/testing', response_model=Resp_Body_Base)
|
||||
async def testing(
|
||||
e_impexium_event_id: str = Query(..., min_length=11, max_length=22), # For ISHLT: 42_AM (2022-04); EX22_AM (2022-04); 41V_2 (2021-04)
|
||||
e_impexium_event_id: str = Path(min_length=11, max_length=22), # For ISHLT: 42_AM (2022-04); EX22_AM (2022-04); 41V_2 (2021-04)
|
||||
registered_since: datetime.datetime = None, # datetime.datetime.now() + datetime.timedelta(seconds=120)
|
||||
details: bool = True,
|
||||
page: int = 0, # 250 per page from Impexium
|
||||
|
||||
@@ -238,7 +238,7 @@ async def event_file_lookup(
|
||||
# Updated 2021-11-23
|
||||
@router.get('/event/file/{event_file_id}/download', response_model=Resp_Body_Base)
|
||||
async def download_event_file(
|
||||
event_file_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_file_id: str = Path(min_length=11, max_length=22),
|
||||
filename: str = Query(None, min_length=4, max_length=100),
|
||||
streaming: bool = False,
|
||||
|
||||
@@ -393,7 +393,7 @@ async def delete_event_file_obj(
|
||||
# Updated 2022-08-18
|
||||
@router.delete('/event/file/{event_file_id}/v2', response_model=Resp_Body_Base)
|
||||
async def delete_event_file_obj_v2(
|
||||
event_file_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_file_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
delete_hosted_file: bool = False, # Not currently used
|
||||
rm_orphan: bool = False,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime, json, os, pathlib, pytz, secrets, shutil, time
|
||||
import pandas, xlrd # qrcode
|
||||
from fastapi import APIRouter, Body, Depends, File, Header, HTTPException, Query, Response, status, UploadFile
|
||||
from fastapi import APIRouter, Body, Depends, File, Header, HTTPException, Path, Query, Response, status, UploadFile
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
@@ -334,7 +334,7 @@ async def event_importing_create_update_w_external_id(
|
||||
# Updated 2024-03-25
|
||||
@router.post('/event/{event_id}/importing/program_data', response_model=Resp_Body_Base)
|
||||
async def event_importing_program_data(
|
||||
event_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_id: str = Path(min_length=11, max_length=22),
|
||||
file: UploadFile = File(...),
|
||||
|
||||
begin_at: int = 0,
|
||||
|
||||
@@ -80,7 +80,7 @@ async def post_event_location_obj_new_v4(
|
||||
@router.patch('/event/location/{event_location_id}/exist_v4', response_model=Resp_Body_Base)
|
||||
async def patch_event_location_obj_exist_v4(
|
||||
event_location_obj: Event_Location_Base,
|
||||
event_location_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_location_id: str = Path(min_length=11, max_length=22),
|
||||
create_sub_obj: bool = False,
|
||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||
|
||||
@@ -139,7 +139,7 @@ async def patch_event_location_obj_exist_v4(
|
||||
# Updated 2022-09-23
|
||||
@router.get('/event/location/{event_location_id}', response_model=Resp_Body_Base)
|
||||
async def get_event_location_obj(
|
||||
event_location_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_location_id: str = Path(min_length=11, max_length=22),
|
||||
inc_event_device_list: bool = False,
|
||||
inc_event_file_list: bool = False,
|
||||
inc_event_file_internal_use_list: bool = False,
|
||||
@@ -189,7 +189,7 @@ async def get_event_location_obj(
|
||||
# Updated 2021-12-13
|
||||
@router.get('/event/{event_id}/event/location/list', response_model=Resp_Body_Base)
|
||||
async def get_event_obj_event_location_list(
|
||||
event_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
hidden: str = 'not_hidden',
|
||||
limit: int = 500,
|
||||
|
||||
@@ -89,7 +89,7 @@ async def v4_post_event_person_obj_new(
|
||||
@router.patch('/v4/event/person/{event_person_id}/exist', response_model=Resp_Body_Base)
|
||||
async def v4_patch_event_person_obj_exist(
|
||||
event_person_obj: Event_Person_Base,
|
||||
event_person_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_person_id: str = Path(min_length=11, max_length=22),
|
||||
create_sub_obj: bool = False,
|
||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||
|
||||
@@ -340,7 +340,7 @@ async def v2_post_event_person_new(
|
||||
@router.patch('/event/person/{event_person_id}/json', response_model=Resp_Body_Base)
|
||||
async def patch_event_person_json(
|
||||
event_person_obj: Event_Person_Base,
|
||||
event_person_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_person_id: str = Path(min_length=11, max_length=22),
|
||||
create_sub_obj: bool = False,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
@@ -380,7 +380,7 @@ async def patch_event_person_json(
|
||||
# Working well as of 2021-06-04. Using as a template for other routes.
|
||||
@router.get('/event/person/{event_person_id}', response_model=Resp_Body_Base)
|
||||
async def get_event_person_obj(
|
||||
event_person_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_person_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Under contact
|
||||
@@ -445,7 +445,7 @@ async def get_event_person_obj(
|
||||
@router.get('/event/{event_id}/person/search', response_model=Resp_Body_Base)
|
||||
async def search_event_person_obj_li(
|
||||
# account_id: str = Query(None, min_length=11, max_length=22),
|
||||
event_id: str = Query(None, min_length=11, max_length=22),
|
||||
event_id: str = Path(min_length=11, max_length=22),
|
||||
event_person_id: str = Query('', max_length=50),
|
||||
external_id: str = Query('', max_length=50),
|
||||
given_name: str = Query('', max_length=25),
|
||||
@@ -607,7 +607,7 @@ async def search_event_person_obj_li(
|
||||
# Updated 2021-08-17
|
||||
@router.get('/event/registration/{event_registration_id}/event/person/list', response_model=Resp_Body_Base)
|
||||
async def get_event_registration_event_person_obj_li(
|
||||
event_registration_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_registration_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
@@ -658,7 +658,7 @@ async def get_event_registration_event_person_obj_li(
|
||||
# NOT FINISHED YET
|
||||
@router.get('/person/{person_id}/event/person/list', response_model=Resp_Body_Base)
|
||||
async def get_person_event_person_obj_li(
|
||||
person_id: str = Query(..., min_length=1, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 1000,
|
||||
inc_address: bool = False,
|
||||
|
||||
@@ -46,7 +46,7 @@ async def post_event_person_tracking_obj(
|
||||
@router.patch('/event/person/tracking/{event_person_tracking_id}', response_model=Resp_Body_Base)
|
||||
async def patch_event_person_tracking_obj(
|
||||
event_person_tracking_obj: Event_Person_Tracking_Base,
|
||||
event_person_tracking_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_person_tracking_id: str = Path(min_length=11, max_length=22),
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -119,7 +119,7 @@ async def get_event_person_tracking_obj(
|
||||
# Updated 2021-09-23
|
||||
@router.get('/event/person/{event_person_id}/tracking/list', response_model=Resp_Body_Base)
|
||||
async def get_event_person_obj_tracking_list(
|
||||
event_person_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_person_id: str = Path(min_length=11, max_length=22),
|
||||
event_session_id: str = Query(None, min_length=11, max_length=22),
|
||||
in_out_type: str = Query(None, min_length=1, max_length=15),
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
@@ -179,7 +179,7 @@ async def get_event_person_obj_tracking_list(
|
||||
# Updated 2021-09-21
|
||||
@router.get('/event/session/{event_session_id}/event/person/tracking/list', response_model=Resp_Body_Base)
|
||||
async def get_event_session_obj_event_person_tracking_list(
|
||||
event_session_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_session_id: str = Path(min_length=11, max_length=22),
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
inc_event_person: bool = False,
|
||||
|
||||
@@ -74,7 +74,7 @@ async def patch_event_presentation_obj(
|
||||
@router.patch('/event/presentation/{event_presentation_id}/json', response_model=Resp_Body_Base)
|
||||
async def patch_event_presentation_json(
|
||||
event_presentation_obj: Event_Presentation_Base,
|
||||
event_presentation_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_presentation_id: str = Path(min_length=11, max_length=22),
|
||||
create_sub_obj: bool = False,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
@@ -114,7 +114,7 @@ async def patch_event_presentation_json(
|
||||
# Working well as of 2021-06-07. Using as a template for other routes.
|
||||
@router.get('/event/presentation/{event_presentation_id}', response_model=Resp_Body_Base)
|
||||
async def get_event_presentation_obj(
|
||||
event_presentation_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_presentation_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # enabled, disabled, all; For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Under contact
|
||||
@@ -183,7 +183,7 @@ async def get_event_presentation_obj(
|
||||
# Updated 2021-10-20
|
||||
@router.get('/event/session/{event_session_id}/event/presentation/list', response_model=Resp_Body_Base)
|
||||
async def get_event_session_event_presentation_li(
|
||||
event_session_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_session_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 50,
|
||||
# inc_address: bool = False,
|
||||
|
||||
@@ -78,7 +78,7 @@ async def patch_event_presenter_obj(
|
||||
@router.patch('/{event_presenter_id}/json', response_model=Resp_Body_Base)
|
||||
async def patch_event_presenter_json(
|
||||
event_presenter_obj: Event_Presenter_Base,
|
||||
event_presenter_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_presenter_id: str = Path(min_length=11, max_length=22),
|
||||
create_sub_obj: bool = False,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
|
||||
@@ -97,7 +97,7 @@ async def get_event_registration_obj_li(
|
||||
|
||||
@router.get('/{event_registration_id}', response_model=Resp_Body_Base)
|
||||
async def get_event_registration_obj(
|
||||
event_registration_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_registration_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
# inc_event_cfg: bool = False,
|
||||
|
||||
@@ -285,7 +285,7 @@ async def patch_event_session_obj(
|
||||
@router.patch('/event/session/{event_session_id}/json', response_model=Resp_Body_Base)
|
||||
async def patch_event_session_json(
|
||||
event_session_obj: Event_Session_Base,
|
||||
event_session_id: str = Query(..., min_length=1, max_length=22),
|
||||
event_session_id: str = Path(min_length=11, max_length=22),
|
||||
create_sub_obj: bool = False,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
@@ -621,8 +621,7 @@ async def get_event_event_session_obj_li(
|
||||
# Updated 2021-09-21
|
||||
@router.get('/event/{event_id}/session/search', response_model=Resp_Body_Base)
|
||||
async def search_event_session_obj_li(
|
||||
# account_id: str = Query(None, min_length=11, max_length=22),
|
||||
event_id: str = Query(None, min_length=11, max_length=22),
|
||||
event_id: str = Path(min_length=11, max_length=22),
|
||||
event_session_id: str = Query('%', max_length=22),
|
||||
event_session_code: str = Query('%', max_length=50),
|
||||
event_session_name: str = Query('%', max_length=50),
|
||||
|
||||
@@ -104,7 +104,7 @@ async def get_flask_cfg_obj_li(
|
||||
@router.get('/{flask_cfg_id}', response_model=Resp_Body_Base)
|
||||
async def get_flask_cfg_obj(
|
||||
flask_cfg_id: int = None,
|
||||
#flask_cfg_id: str = Query(..., min_length=1, max_length=22),
|
||||
#flask_cfg_id: str = Path(min_length=11, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
include: Optional[list] = [],
|
||||
|
||||
@@ -78,7 +78,7 @@ router = APIRouter()
|
||||
@router.patch('/grant/{grant_id}', response_model=Resp_Body_Base)
|
||||
async def patch_grant_obj(
|
||||
grant_obj: Grant_In,
|
||||
grant_id: str = Query(..., min_length=11, max_length=22),
|
||||
grant_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
return_obj: bool = True,
|
||||
inc_event_abstract: bool = False,
|
||||
@@ -122,7 +122,7 @@ async def patch_grant_obj(
|
||||
# Updated 2023-03-22
|
||||
@router.get('/grant/{grant_id}', response_model=Resp_Body_Base)
|
||||
async def get_grant_obj(
|
||||
grant_id: str = Query(..., min_length=11, max_length=22),
|
||||
grant_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
inc_event_abstract: bool = False,
|
||||
|
||||
@@ -164,7 +164,7 @@ async def get_grant_obj(
|
||||
# Updated 2023-06-23
|
||||
@router.get('/event/{event_id}/grant/list', response_model=Resp_Body_Base)
|
||||
async def get_event_id_grant_obj_li(
|
||||
event_id: str = Query(..., min_length=11, max_length=22),
|
||||
event_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
inc_event_abstract: bool = False,
|
||||
|
||||
@@ -218,7 +218,7 @@ async def get_event_id_grant_obj_li(
|
||||
# # Updated 2023-03-22
|
||||
# @router.delete('/grant/{grant_id}', response_model=Resp_Body_Base)
|
||||
# def delete_grant_obj(
|
||||
# grant_id: str = Query(..., min_length=11, max_length=22),
|
||||
# grant_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
# method: str = None, # None, delete, disable, hide
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import aiofiles, datetime, hashlib, mimetypes, os, pathlib, random, shutil, subprocess, shlex, tempfile, time
|
||||
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Query, Response, status, UploadFile
|
||||
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Path, Query, Response, status, UploadFile
|
||||
from fastapi.responses import FileResponse, StreamingResponse
|
||||
# from fastapi.responses import StreamingResponse
|
||||
# from baize.asgi.responses import FileResponse
|
||||
@@ -909,7 +909,7 @@ async def get_hosted_file_obj(
|
||||
# Updated 2021-09-07
|
||||
@router.get('/hash/{hosted_file_hash}', response_model=Resp_Body_Base)
|
||||
async def check_hosted_file_obj_w_hash(
|
||||
hosted_file_hash: str = Query(..., min_length=64, max_length=64), # Expects SHA256 hash
|
||||
hosted_file_hash: str = Path(min_length=64, max_length=64), # Expects SHA256 hash
|
||||
check_for_local: Optional[bool] = True,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
@@ -955,8 +955,8 @@ async def check_hosted_file_obj_w_hash(
|
||||
# Updated 2023-04-05
|
||||
@router.get('/tmp/{subdirectory}/{filename}/download', response_model=Resp_Body_Base)
|
||||
async def download_tmp(
|
||||
subdirectory: str = Query(..., min_length=1, max_length=100),
|
||||
filename: str = Query(..., min_length=4, max_length=120),
|
||||
subdirectory: str = Path(min_length=1, max_length=100),
|
||||
filename: str = Path(min_length=4, max_length=120),
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
|
||||
@@ -154,7 +154,7 @@ async def get_journal_entry_obj(
|
||||
# Updated 2021-07-22
|
||||
@router.get('/journal/{journal_id}/entry/list', response_model=Resp_Body_Base)
|
||||
async def get_journal_obj_journal_entry_list(
|
||||
journal_id: str = Query(..., min_length=1, max_length=22),
|
||||
journal_id: str = Path(min_length=11, max_length=22),
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
inc_private: bool = False,
|
||||
|
||||
@@ -74,7 +74,7 @@ async def patch_log_client_viewing_obj(
|
||||
# Updated 2021-07-01
|
||||
@router.get('/account/{account_id}/log/client_viewing/list', response_model=Resp_Body_Base)
|
||||
async def get_account_log_client_viewing_obj_li(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 1000,
|
||||
from_datetime: datetime.datetime = None,
|
||||
|
||||
@@ -21,7 +21,7 @@ router = APIRouter()
|
||||
# ### BEGIN ### API Lookup ### get_lookup_li() ###
|
||||
@router.get('/{for_lookup_name}/list', response_model=Resp_Body_Base)
|
||||
async def get_lookup_li(
|
||||
for_lookup_name: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
for_lookup_name: Optional[str] = Path(min_length=2, max_length=50),
|
||||
account_id: Optional[str] = Query(None, min_length=11, max_length=50),
|
||||
for_type: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
inc_admin_options: bool = False,
|
||||
|
||||
@@ -21,7 +21,7 @@ router = APIRouter()
|
||||
# Updated 2021-07-13
|
||||
@router.get('/account/{account_id}/membership/cfg', response_model=Resp_Body_Base)
|
||||
async def get_account_obj_membership_cfg(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
|
||||
@@ -97,7 +97,7 @@ async def get_membership_group_obj_li(
|
||||
# Updated 2021-07-01
|
||||
@router.get('/account/{account_id}/membership/group/list', response_model=Resp_Body_Base)
|
||||
async def get_account_membership_group_obj_li(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
# product_id: Optional[str] = Query(None, min_length=1, max_length=22),
|
||||
# type_level: Optional[int] = None,
|
||||
enabled: str = 'enabled',
|
||||
@@ -251,7 +251,7 @@ async def lookup_membership_group_obj(
|
||||
# Working well as of 2021-06-21. Using as a template for other routes.
|
||||
@router.get('/membership/group/{membership_group_id}', response_model=Resp_Body_Base)
|
||||
async def get_membership_group_obj(
|
||||
membership_group_id: str = Query(..., min_length=1, max_length=22),
|
||||
membership_group_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Per member
|
||||
|
||||
@@ -84,7 +84,7 @@ async def post_membership_person_obj(
|
||||
@router.patch('/membership/person/{membership_person_id}', response_model=Resp_Body_Base)
|
||||
async def patch_membership_person_obj(
|
||||
membership_person_obj: Membership_Person_Base,
|
||||
membership_person_id: Optional[str] = Query(..., min_length=11, max_length=22),
|
||||
membership_person_id: Optional[str] = Path(min_length=11, max_length=22),
|
||||
|
||||
create_sub_obj: bool = False,
|
||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||
@@ -265,7 +265,7 @@ async def get_person_obj_membership_person(
|
||||
# Updated 2022-01-11
|
||||
@router.get('/account/{account_id}/membership/person/list', response_model=Resp_Body_Base)
|
||||
async def get_account_obj_membership_person_list(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
# inc_account_cfg: bool = False,
|
||||
# inc_address: bool = False, # Under contact
|
||||
# inc_contact: bool = False,
|
||||
|
||||
@@ -74,7 +74,7 @@ async def patch_membership_person_group_obj(
|
||||
# Updated 2021-07-27
|
||||
@router.get('/membership/group/person/{membership_person_group_id}', response_model=Resp_Body_Base)
|
||||
async def get_membership_person_group_obj(
|
||||
membership_person_group_id: str = Query(..., min_length=1, max_length=22),
|
||||
membership_person_group_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_product: bool = False, # Per member or group member belongs to
|
||||
|
||||
@@ -74,7 +74,7 @@ async def patch_membership_person_profile_obj(
|
||||
# Updated 2021-07-13
|
||||
@router.get('/membership/person/{membership_person_id}/profile', response_model=Resp_Body_Base)
|
||||
async def get_membership_person_obj_profile(
|
||||
membership_person_id: str = Query(..., min_length=1, max_length=22),
|
||||
membership_person_id: str = Path(min_length=11, max_length=22),
|
||||
inc_membership_cfg: bool = False,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
|
||||
@@ -74,7 +74,7 @@ async def patch_membership_person_type_obj(
|
||||
# Updated 2021-07-27
|
||||
@router.get('/membership/type/person/{membership_person_type_id}', response_model=Resp_Body_Base)
|
||||
async def get_membership_person_type_obj(
|
||||
membership_person_type_id: str = Query(..., min_length=1, max_length=22),
|
||||
membership_person_type_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_product: bool = False, # Per member or group member belongs to
|
||||
|
||||
@@ -252,7 +252,7 @@ async def lookup_membership_type_obj(
|
||||
# Working well as of 2021-07-01. Using as a template for other routes.
|
||||
@router.get('/membership/type/{membership_type_id}', response_model=Resp_Body_Base)
|
||||
async def get_membership_type_obj(
|
||||
membership_type_id: str = Query(..., min_length=1, max_length=22),
|
||||
membership_type_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Per member
|
||||
|
||||
@@ -177,7 +177,7 @@ async def get_order_obj_li(
|
||||
# Updated 2021-08-07
|
||||
@router.get('/order/{order_id}', response_model=Resp_Body_Base)
|
||||
async def get_order_obj(
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
limit: int = 500,
|
||||
enabled: str = 'enabled',
|
||||
inc_order_line_list: bool = False,
|
||||
@@ -214,7 +214,7 @@ async def get_order_obj(
|
||||
# Updated 2021-12-13
|
||||
@router.get('/{obj_type}/{obj_id}/order/list', response_model=Resp_Body_Base)
|
||||
async def get_obj_id_order_list(
|
||||
obj_type: str = Query(..., min_length=4, max_length=25), # Expects account or person
|
||||
obj_type: str = Path(min_length=4, max_length=25), # Expects account or person
|
||||
obj_id: str = Path(min_length=11, max_length=22),
|
||||
from_datetime: datetime.datetime = None,
|
||||
to_datetime: datetime.datetime = None,
|
||||
@@ -396,7 +396,7 @@ async def get_obj_id_order_list(
|
||||
# Updated 2021-11-19
|
||||
@router.get('/person/{person_id}/order/cart', response_model=Resp_Body_Base)
|
||||
async def get_person_id_order_cart(
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
inc_order_line_list: bool = False,
|
||||
inc_order_cfg: bool = False,
|
||||
@@ -435,7 +435,7 @@ async def delete_order_obj(
|
||||
# NOTE: The router needs to have the prefix (/order) removed.
|
||||
@router.delete('/order/{order_id}/line/<order_line_id>/remove', response_model=Resp_Body_Base)
|
||||
async def delete_order_line_obj_NOT_SURE(
|
||||
order_id: str = Query(..., min_length=1, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
obj: Order_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
|
||||
@@ -21,7 +21,7 @@ router = APIRouter()
|
||||
# Updated 2022-01-04
|
||||
@router.get('/{obj_type}/{obj_id}/order/line/list', response_model=Resp_Body_Base)
|
||||
async def get_obj_id_order_line_list(
|
||||
obj_type: str = Query(..., min_length=4, max_length=25), # Expects account or order or person
|
||||
obj_type: str = Path(min_length=4, max_length=25), # Expects account or order or person
|
||||
obj_id: str = Path(min_length=11, max_length=22),
|
||||
from_datetime: datetime.datetime = None,
|
||||
to_datetime: datetime.datetime = None,
|
||||
|
||||
@@ -325,7 +325,7 @@ async def patch_order_obj_remove_line(
|
||||
# Updated 2022-01-18
|
||||
@router.get('/v3/{for_obj_type}/{for_obj_id}/order/list', response_model=Resp_Body_Base)
|
||||
async def get_order_obj_li(
|
||||
for_obj_type: str = Query(..., min_length=2, max_length=50),
|
||||
for_obj_type: str = Path(min_length=2, max_length=50),
|
||||
for_obj_id: str = Path(min_length=11, max_length=22),
|
||||
order_status: str = 'complete',
|
||||
order_checkout_status: str = 'complete',
|
||||
|
||||
@@ -115,7 +115,7 @@ async def post_organization_json(
|
||||
@router.patch('/{organization_id}/json', response_model=Resp_Body_Base)
|
||||
async def patch_organization_json(
|
||||
organization_obj: Organization_Base,
|
||||
organization_id: str = Query(..., min_length=1, max_length=22),
|
||||
organization_id: str = Path(min_length=11, max_length=22),
|
||||
process_contact: bool = False,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
@@ -174,7 +174,7 @@ async def get_organization_obj_li(
|
||||
|
||||
@router.get('/{organization_id}', response_model=Resp_Body_Base)
|
||||
async def get_organization_obj(
|
||||
organization_id: str = Query(..., min_length=1, max_length=22),
|
||||
organization_id: str = Path(min_length=11, max_length=22),
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
x_account_id: str = Header(...),
|
||||
|
||||
@@ -98,8 +98,8 @@ async def get_page_obj_li(
|
||||
# Updated 2021-08-20
|
||||
@router.get('/alias/{alias}', response_model=Resp_Body_Base)
|
||||
async def get_page_obj_alias(
|
||||
alias: str = Path(min_length=1, max_length=255),
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
alias: str = Query(..., min_length=1, max_length=255),
|
||||
enabled: str = 'enabled',
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
|
||||
@@ -89,7 +89,7 @@ async def post_person_obj(
|
||||
@router.patch('/person/{person_id}', response_model=Resp_Body_Base)
|
||||
async def patch_person_obj(
|
||||
person_obj: Person_Base,
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
contact_id: str = Query(None, min_length=11, max_length=22),
|
||||
organization_id: str = Query(None, min_length=11, max_length=22),
|
||||
user_id: str = Query(None, min_length=11, max_length=22),
|
||||
@@ -278,7 +278,7 @@ async def lookup_email(
|
||||
# Updated 2021-12-03
|
||||
@router.get('/person/{person_id}/email_auth_key_url', response_model=Resp_Body_Base)
|
||||
async def email_auth_key_url(
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
root_url: Optional[str] = Query(None, min_length=10, max_length=100), # Absolute min = 7
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
@@ -307,7 +307,7 @@ async def email_auth_key_url(
|
||||
# Updated 2021-12-15
|
||||
@router.get('/person/{person_id}', response_model=Resp_Body_Base)
|
||||
async def get_person_obj(
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
auth_key: str = Query(None, min_length=11, max_length=22), # If passed, it must match in the person record. New 2021-12-15
|
||||
inc_address: bool = False, # Priority l1
|
||||
# inc_archive_list: bool = False, # Priority l3
|
||||
@@ -395,7 +395,7 @@ async def get_person_obj(
|
||||
# Updated 2022-01-05
|
||||
@router.get('/account/{account_id}/person/list', response_model=Resp_Body_Base)
|
||||
async def get_account_obj_person_list(
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
|
||||
@@ -98,7 +98,7 @@ async def get_post_obj_li(
|
||||
# Updated 2021-12-13
|
||||
@router.get('/account/{account_id}/post/list', response_model=Resp_Body_Base)
|
||||
async def get_account_obj_post_list(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
limit: int = 500, # For now this covers any included objects or object lists
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
archive_on: datetime.datetime = None,
|
||||
|
||||
@@ -118,7 +118,7 @@ async def get_product_obj_li(
|
||||
|
||||
@router.get('/account/{account_id}/product/list', response_model=Resp_Body_Base)
|
||||
async def get_account_product_obj_li(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
for_obj_type: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, min_length=1, max_length=22),
|
||||
prod_type: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os, pathlib, qrcode, time
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Query, Response, status, UploadFile
|
||||
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Path, Query, Response, status, UploadFile
|
||||
from fastapi.responses import FileResponse
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
@@ -23,9 +23,9 @@ router = APIRouter()
|
||||
@router.get('/qr/{account_id}/{qr_id}', response_model=Resp_Body_Base)
|
||||
@router.get('/qr/{qr_id}', response_model=Resp_Body_Base)
|
||||
async def get_qr(
|
||||
# account_id: str = Query(..., min_length=11, max_length=22),
|
||||
qr_id: str = Query(..., min_length=11, max_length=22),
|
||||
account_id: str = Query(None, min_length=11, max_length=22),
|
||||
# account_id: str = Path(min_length=11, max_length=22),
|
||||
qr_id: str = Path(min_length=11, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
regen: bool = False,
|
||||
qr_type: str = Query(None, min_length=1, max_length=10),
|
||||
filename: str = Query(None, min_length=4, max_length=100),
|
||||
|
||||
@@ -137,7 +137,7 @@ async def delete_site_obj(
|
||||
# Updated 2021-12-13
|
||||
@router.get('/account/{account_id}/site/list', response_model=Resp_Body_Base)
|
||||
async def get_account_site_obj_li(
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
inc_site_domain_list: bool = False,
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ async def get_site_domain_obj_li(
|
||||
|
||||
@router.get('/site/domain/{site_domain_id}', response_model=Resp_Body_Base)
|
||||
async def get_site_domain_obj(
|
||||
site_domain_id: str = Query(..., min_length=11, max_length=22),
|
||||
site_domain_id: str = Path(min_length=11, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
|
||||
@@ -174,7 +174,7 @@ async def patch_user_obj(
|
||||
# @router.get('/user/new_auth_key', response_model=Resp_Body_Base)
|
||||
@router.get('/user/{user_id}/new_auth_key', response_model=Resp_Body_Base)
|
||||
async def user_new_auth_key(
|
||||
user_id: str = Query(..., min_length=11, max_length=22),
|
||||
user_id: str = Path(min_length=11, max_length=22),
|
||||
return_obj: bool = False,
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
@@ -483,7 +483,7 @@ async def user_verify_password(
|
||||
# Updated 2021-12-13
|
||||
@router.get('/account/{account_id}/user/list', response_model=Resp_Body_Base)
|
||||
async def get_account_user_obj_li(
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
hidden: str = 'not_hidden', # hidden, not_hidden, all
|
||||
inc_address: bool = False, # Priority l1
|
||||
inc_contact: bool = False, # Priority l1
|
||||
@@ -792,7 +792,7 @@ async def lookup_username(
|
||||
# @router.get('/user/email_auth_key_url', response_model=Resp_Body_Base)
|
||||
@router.get('/user/{user_id}/email_auth_key_url', response_model=Resp_Body_Base)
|
||||
async def email_auth_key_url(
|
||||
user_id: str = Query(..., min_length=11, max_length=22),
|
||||
user_id: str = Path(min_length=11, max_length=22),
|
||||
root_url: Optional[str] = Query(None, min_length=10, max_length=100), # Absolute min = 7
|
||||
return_obj: bool = False,
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
@@ -822,7 +822,7 @@ async def email_auth_key_url(
|
||||
# Updated 2022-01-05
|
||||
@router.get('/user/{user_id}', response_model=Resp_Body_Base)
|
||||
async def get_user_obj(
|
||||
user_id: str = Query(..., min_length=11, max_length=22),
|
||||
user_id: str = Path(min_length=11, max_length=22),
|
||||
inc_address: bool = False, # Priority l1
|
||||
# inc_archive_list: bool = False, # Priority l3
|
||||
inc_contact: bool = False, # Priority l1
|
||||
@@ -887,7 +887,7 @@ async def get_user_obj(
|
||||
# # Deprecated 2021-11-19
|
||||
# @router.get('/user/{user_id}/order_list', response_model=Resp_Body_Base)
|
||||
# async def get_user_obj_order_list(
|
||||
# user_id: str = Query(..., min_length=1, max_length=22),
|
||||
# user_id: str = Path(min_length=11, max_length=22),
|
||||
#
|
||||
#
|
||||
# from_datetime: datetime.datetime = None,
|
||||
|
||||
Reference in New Issue
Block a user