private static SMRequest ConstructSMRequest(Challenge challenge) { SMRequest retVal = new SMRequest(); retVal.challenge = challenge; return retVal; }
private static SMRequest ConstructSMRequest(User user) { SMRequest retVal = new SMRequest(); retVal.user = user; return retVal; }
public static async Task<User> createUser(string externalId, String email, UserGender gender, String dob, String ipAddress) { IPAddress address; if (!IPAddress.TryParse(ipAddress, out address)) { Console.Write("UserFactory - Create User - Invalid IP - " + ipAddress); return null; } var myUser = new User { external_id = externalId, email = email, dob = dob, gender = gender.ToString("g"), ip = ipAddress }; SMRequest createUserRequest = new SMRequest(); createUserRequest.user = myUser; SMResponse m = await AsyncClient.post(APIRoutes.createUserRoute(), createUserRequest); if (m == null) return null; return m.user; }
public static async Task<IList<Offer>> getAllOffersByExternalId(String externalId, string locale = null) { SMRequest offerRequest = new SMRequest(); SMResponse m = await AsyncClient.get(APIRoutes.fetchOffersWithExternalIdRoute(externalId)); if (m == null) return null; return m.offers; }
public static async Task<bool> addToUserModel(IAttributes attributes) { SMRequest createAddRequest = new SMRequest(); createAddRequest.attributes = attributes; SMResponse m = await AsyncClient.post(APIRoutes.addAttributesToUserModel(), createAddRequest); if (m == null) return false; if (m.model == null) { return false; } else { return true; } }
public static async Task<IList<Offer>> getAllOffers(string locale = null) { SMRequest offerRequest = new SMRequest(); SMResponse m = await AsyncClient.get(APIRoutes.fetchOffersRoute()); if (m == null) return null; return m.offers; }
public static async Task<bool> sendEventByExternalId(string externalId, IEvents events) { SMRequest createUserRequest = new SMRequest(); createUserRequest.autoClaim = true; createUserRequest.events = events; await AsyncClient.post(API.APIRoutes.sendEventWithExternalIdRoute(externalId), createUserRequest); return true; }
public static async Task <SMResponse> put(string path, SMRequest request) { string json = JsonConvert.SerializeObject(request, Formatting.Indented, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore }); string responseString = await putResponseString(path, json); SMResponse m = JsonConvert.DeserializeObject <SMResponse>(responseString); return(m); }
public static async Task<ImageValidation> validateImage(User user, ImageValidation img) { SMRequest imageValidationRequest = new SMRequest(); imageValidationRequest.user = user; imageValidationRequest.imageValidation = img; string route = String.IsNullOrEmpty(user.id) ? APIRoutes.validateImageWithUserIdRoute(user.id) : APIRoutes.validateImageWithExternalIdRoute(user.external_id); SMResponse m = await AsyncClient.post(route, imageValidationRequest); return m == null ? null : m.GetImageValidationModel(); }
public static async Task<User> updateUserProfileById(string id, Dictionary<string, string> meta) { var myUser = new User { user_profile = meta }; SMRequest createUserRequest = new SMRequest(); createUserRequest.user = myUser; SMResponse m = await AsyncClient.put(APIRoutes.updateUserWithId() + id, createUserRequest); if (m == null) return null; return m.GetUserResponseModel(); }
public static async Task<Order> createOrderByExternalId(String offerId, String ipAddress, String ExternalId) { IPAddress address; if (!IPAddress.TryParse(ipAddress, out address)) { Console.WriteLine("UserFactory - Create User - Invalid IP - " + ipAddress); return null; } Order myOrder = new Order { quantity = 1, recaptcha_challenge_field = "", recaptcha_response_field = "", ip = ipAddress, email = "" }; SMRequest newOrderRequest = new SMRequest(); newOrderRequest.order = myOrder; SMResponse m = await AsyncClient.post(APIRoutes.createNewOrderForOfferWithExternalIdRoute(offerId,ExternalId), newOrderRequest); if (m == null) return null; return m.order; }
public static async Task<SMResponse> put(string path, SMRequest request) { string json = JsonConvert.SerializeObject(request, Formatting.Indented, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore }); string responseString = await putResponseString(path, json); SMResponse m = JsonConvert.DeserializeObject<SMResponse>(responseString); return m; }
private static SMRequest ConstructSMRequest(Verification verification) { SMRequest request = new SMRequest(); request.verification = verification; return request; }
private static SMRequest ConstructSMRequest(User user) { SMRequest request = new SMRequest(); request.user = user; return request; }