""" AUTHOR: Khushal P Soonderji DATE: Saturday, 4th Jan., 2025. OBJECTIVE: To provide a structure to represent OAuth callback responses. REFERENCES: N/A DOWNLOADS: N/A """ # ***************************************************************************************************************** # ***** **** # *** IMPORT *** # ***** **** # ***************************************************************************************************************** # To make sibling directories accessible for imports: import sys sys.path.append(".") sys.path.append("..") # For making data behaviour_models: from pydantic import BaseModel, Field, field_validator, PastDatetime, model_validator, AwareDatetime from typing import Optional, Literal, Union, List, Any # My utils: from utils_v2.string import regex from utils_v2.date_time import date_time # To work with date and time: import datetime # ***************************************************************************************************************** # ***** **** # *** MACROS / ONE-TIME INIT *** # ***** **** # ***************************************************************************************************************** # --- Nothing Yet # ***************************************************************************************************************** # ***** **** # *** VARIABLES *** # ***** **** # ***************************************************************************************************************** # --- Nothing Yet # ***************************************************************************************************************** # ***** **** # *** FUNCTIONS *** # ***** **** # ***************************************************************************************************************** class PaperTradingAuth(BaseModel): username: str = Field( description = "??", frozen = True ) password: str = Field( description = "??", frozen = True ) # ┏┓ ┏• # ┃ ┏┓┏┓╋┓┏┓ # ┗┛┗┛┛┗┛┗┗┫ # ┛ class Config: extra = "forbid" # --------------------------------------------------------------------------------------------------------------------- class ZerodhaKiteAuth(BaseModel): userId: str = Field( description = "How Zerodha's Kite platform identifies this user.", frozen = True, alias = "clientId" ) apiKey: str = Field( description = ( "The API key of your Kite app. " "This remains constant throughout the life of the app." ), frozen = True ) apiSecret: str = Field( description = ( "The API secret of your Kite app. " "This can be changed if you think the security of your app has been compromised." ), frozen = True ) # ┏┓ ┏• # ┃ ┏┓┏┓╋┓┏┓ # ┗┛┗┛┛┗┛┗┗┫ # ┛ class Config: extra = "forbid" populate_by_name = True # --------------------------------------------------------------------------------------------------------------------- class ICICIBreezeAuth(BaseModel): userId: str = Field( description = "How ICICI's Breeze platform identifies this user.", frozen = True, alias = "clientId" ) apiKey: str = Field( description = ( "The API key of your Breeze app. " "This remains constant throughout the life of the app." ), frozen = True ) apiSecret: str = Field( description = ( "The API secret of your Breeze app. " "This can be changed if you think the security of your app has been compromised." ), frozen = True ) # ┏┓ ┏• # ┃ ┏┓┏┓╋┓┏┓ # ┗┛┗┛┛┗┛┗┗┫ # ┛ class Config: extra = "forbid" populate_by_name = True # --------------------------------------------------------------------------------------------------------------------- class TradingOAuthCallbackResponse(BaseModel): success: bool = Field( description = "To indicate whether or not, the action was a success", frozen = False, default = False ) message: str = Field( description = "To explain what happened in the process of handling the OAuth callback.", frozen = False, default = "ERR: Message not captured." ) exception: Any = Field( description = "To pass on any exception that occurred in the process.", frozen = False, default = None ) # ┏┓ ┏• # ┃ ┏┓┏┓╋┓┏┓ # ┗┛┗┛┛┗┛┗┗┫ # ┛ class Config: extra = "forbid" # ┏┓ ┏┓ # ┃ ┓┏┏╋┏┓┏┳┓ ┣ ┓┏┏┓┏┏ # ┗┛┗┻┛┗┗┛┛┗┗ ┻ ┗┻┛┗┗┛ pass # ┓┏ ┓• ┓ • # ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓ # ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗ pass # ***************************************************************************************************************** # ***** **** # *** MAIN PROGRAM *** # ***** **** # ***************************************************************************************************************** if __name__ == "__main__": pass