public ApiManager() { // Default values for variables about token this.apiToken = Constants.Api_Token_Not_Defined; this.apiKeyParamName = Constants.Api_Param_Name_Not_Defined; this.tokenHttpEmplacement = TokenHttpEmplacement.Everywhere; this.hasToHaveTokenForApi = false; this.hasToLoginToGetToken = false; this.canRegisterAsUserToApi = false; this.apiDataModelEndpointType = ApiDataModelEndpointType.FullyNested; // Use "worst" case scenario by default // Default values for Login/Register page parameters name this.pseudoParamNameForApiLoginOrRegistering = "pseudo"; this.passwordParamNameForApiLoginOrRegistering = "password"; this.firstnameParamNameForApiRegistering = "firstname"; this.lastNameParamNameForApiRegistering = "lastname"; this.emailParamNameForApiRegistering = "email"; }
public static void SetTokenAccordingToEmplacement(ref HttpWebRequest req, string method, ref string bodyData, TokenHttpEmplacement tokenttpEmplacement) { if (tokenttpEmplacement == TokenHttpEmplacement.BodyOrUrlParam || tokenttpEmplacement == TokenHttpEmplacement.Everywhere) { if (method == "GET") // Put token in url { PutTokenInUrl(ref req); } else if (method == "POST") // Put token in body { PutTokenInBody(ref bodyData); } else // Not "GET" or "POST" { Debug.LogError("[WARNING]: The parameter (method) passed to SetTokenAccordingToEmplacement is neither \"GET\" or \"POST\""); } } if (tokenttpEmplacement == TokenHttpEmplacement.Header || tokenttpEmplacement == TokenHttpEmplacement.Everywhere) { PutTokenInHeader(ref req); } }