From b753975a83af5684846211dc42b98837538d3c6b Mon Sep 17 00:00:00 2001 From: StevanFreeborn Date: Fri, 29 Apr 2022 13:15:49 -0500 Subject: [PATCH] begin adding doc strings to endpoint helper --- Endpoints.py | 75 ++++++++++++++++++++++++++++++++++++++++++++++- OnspringClient.py | 2 +- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/Endpoints.py b/Endpoints.py index 861f8ab..17cce57 100644 --- a/Endpoints.py +++ b/Endpoints.py @@ -3,28 +3,101 @@ import uuid # connectivity endpoints def GetPingEndpoint(baseUrl: str): + """ + Returns the ping endpoint. + + Args: + baseUrl (`str`): The base url for the api. + + Returns: + The ping endpoint as a string. + """ + return f'{baseUrl}/Ping' # app endpoints def GetAppsEndpoint(baseUrl: str): + """ + Returns the get apps endpoint. + + Args: + baseUrl (`str`): The base url for the api. + + Returns: + The get apps endpoint as a string. + """ + return f'{baseUrl}/Apps' def GetAppByIdEndpoint(baseUrl: str, appId: int): + """ + Returns the get app by id endpoint. + + Args: + baseUrl (`str`): The base url for the api. + appId (`int`): The id of the app being requested. + + Returns: + The get app by id endpoint as a string. + """ + return f'{baseUrl}/Apps/id/{appId}' -def GetAppByIdsEndpoint(baseUrl: str): +def GetAppsByIdsEndpoint(baseUrl: str): + """ + Returns the get apps by ids endpoint. + + Args: + baseUrl (`str`): The base url for the api. + + Returns: + The get apps by ids endpoint as a string. + """ + return f'{baseUrl}/Apps/batch-get' # field endpoints def GetFieldByIdEndpoint(baseUrl: str, fieldId: int): + """ + Returns the get field by id endpoint. + + Args: + baseUrl (`str`): The base url for the api. + fieldId (`int`): The id of the field being requested. + + Returns: + The get field by id endpoint as a string. + """ + return f'{baseUrl}/Fields/id/{fieldId}' def GetFieldsByIdsEndpoint(baseUrl: str): + """ + Returns the get fields by ids endpoint. + + Args: + baseUrl (`str`): The base url for the api. + + Returns: + The get fields by ids endpoint as a string. + """ + return f'{baseUrl}/Fields/batch-get' def GetFieldsByAppIdEndpoint(baseUrl: str, appId: int): + """ + Returns the get fields by app id endpoint. + + Args: + baseUrl (`str`): The base url for the api. + appId (`int`): The id of the app whose fields are being requested. + + Returns: + The get fields by app id endpoint as a string. + """ + return f'{baseUrl}/Fields/appId/{appId}' # file endpoints diff --git a/OnspringClient.py b/OnspringClient.py index 1d01c3d..8a08a96 100644 --- a/OnspringClient.py +++ b/OnspringClient.py @@ -179,7 +179,7 @@ class OnspringClient: An ApiResponse (`Models.ApiResponse`) containing the results of the request. """ - endpoint = GetAppByIdsEndpoint(self.baseUrl) + endpoint = GetAppsByIdsEndpoint(self.baseUrl) self.headers['Content-Type'] = 'application/json'