/// <summary> /// Retorna as informações da Escola /// </summary> /// <param name="onSucess">Callback de sucesso</param> /// <param name="onError">Callback de erro</param> public void GetEscola(Action <EscolaResponse> onSucess = null, Action <Exception> onError = null) { RestClient.Get(basePath + "/obter/escola").Then(proxy => { EscolaResponse response = JsonUtility.FromJson <EscolaResponse>(proxy.Text); LogMessage("Response", JsonUtility.ToJson(response, true)); onSucess.Invoke(response); }).Catch(err => { LogMessage("Error", err.Message); onError.Invoke(err); }); }
public void OnGetEscola(EscolaResponse escolaResponse) { if (escolaResponse.sucesso == "false") { Debug.Log("API retornou um falso sucesso."); return; } if (escolaResponse.retorno == null) { Debug.Log("API retornou um retorno nulo."); return; } CreateNewSchool(escolaResponse.retorno); }