Untitled

mail@pastecode.io avatar
unknown
c_cpp
3 years ago
1.6 kB
2
Indexable
Never
		// register user 1
		const FRequest_Register regReq = {"devid1", "unit_test1@dd.com", USER_PASS_1, USER_NAME_1};
		UE_LOG(LogTemp, Log, TEXT("Requesting Register ..."));
		client->Register(regReq, FOnResponse_Register::CreateLambda([client](EResponseType Status, int Code, const FResponse_Register& Resp)
		{
			check(Code == 200);
			UE_LOG(LogTemp, Log, TEXT("Register: %s"), *Resp.Message);

			// login
			const FRequest_Login logReq = {USER_PASS_1, USER_NAME_1};
			UE_LOG(LogTemp, Log, TEXT("Requesting Login: " USER_NAME_1));
			client->Login(logReq, FOnResponse_Login::CreateLambda([client](EResponseType Status, int Code, const FResponse_Login& Resp)
			{
				check(Code == 200);
				UE_LOG(LogTemp, Log, TEXT("Login: %s"), *Resp.Message);
				client->SetToken(Resp.Token);

				// get user profile
				UE_LOG(LogTemp, Log, TEXT("Requesting user profile: " USER_NAME_1));
				client->GetProfile(FOnResponse_GetProfile::CreateLambda([client](EResponseType Status, int Code, const FResponse_GetProfile& Resp)
				{
					check(Code == 200);
					UE_LOG(LogTemp, Log, TEXT("Profile: Name: %s Id: %i"), *Resp.Name, Resp.UserId);

					// friend request user
					const FRequest_AddFriendRequest addfReq = {Resp.UserId, USER_NAME_0};
					UE_LOG(LogTemp, Log, TEXT("AddFriendRequest: " USER_NAME_1));
					client->AddFriendRequest(addfReq, FOnResponse_AddFriendRequest::CreateLambda([](EResponseType Status, int Code, const FResponse_AddFriendRequest& Resp)
					{
						check(Code == 200);
						UE_LOG(LogTemp, Log, TEXT("Add Friend Request: %s"), *Resp.Message);
					}));
				}));