mirror of
				https://github.com/bspeice/UNCCGameDay
				synced 2025-11-04 02:10:35 -05:00 
			
		
		
		
	Add the initial Retrofit REST API code
Note: Completely untested, but it looks cool!
This commit is contained in:
		
							
								
								
									
										15
									
								
								src/com/uncc/gameday/registration/GamedayService.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/com/uncc/gameday/registration/GamedayService.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					package com.uncc.gameday.registration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import retrofit.http.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface GamedayService {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@GET("/lots/")
 | 
				
			||||||
 | 
						List<ParkingLot> listLots();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@POST("/rating/")
 | 
				
			||||||
 | 
						void rateLot(@Body ParkingRating rating, @Body ParkingChoices parking_lot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/com/uncc/gameday/registration/ParkingChoices.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/com/uncc/gameday/registration/ParkingChoices.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					package com.uncc.gameday.registration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum ParkingChoices {
 | 
				
			||||||
 | 
						GREEN ("GREEN"),
 | 
				
			||||||
 | 
						BLACK ("BLACK"),
 | 
				
			||||||
 | 
						RED ("RED"),
 | 
				
			||||||
 | 
						BLUE ("BLUE"),
 | 
				
			||||||
 | 
						SILVER ("SILVER"),
 | 
				
			||||||
 | 
						ORANGE ("ORANGE"),
 | 
				
			||||||
 | 
						YELLOW ("YELLOW"),
 | 
				
			||||||
 | 
						PURPLE ("PURPLE"),
 | 
				
			||||||
 | 
						PINK ("PINK"),
 | 
				
			||||||
 | 
						WHITE ("WHITE"),
 | 
				
			||||||
 | 
						GOLD ("GOLD");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						String choice;
 | 
				
			||||||
 | 
						ParkingChoices(String choice) { this.choice = choice; }
 | 
				
			||||||
 | 
						public String getValue() { return choice; }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								src/com/uncc/gameday/registration/ParkingLot.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/com/uncc/gameday/registration/ParkingLot.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package com.uncc.gameday.registration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ParkingLot {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						ParkingChoices location;
 | 
				
			||||||
 | 
						int filled_pct;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										6
									
								
								src/com/uncc/gameday/registration/ParkingRating.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/com/uncc/gameday/registration/ParkingRating.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					package com.uncc.gameday.registration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ParkingRating {
 | 
				
			||||||
 | 
						ParkingChoices parking_lot;
 | 
				
			||||||
 | 
						RatingChoices rating;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										12
									
								
								src/com/uncc/gameday/registration/RatingChoices.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/com/uncc/gameday/registration/RatingChoices.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					package com.uncc.gameday.registration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum RatingChoices {
 | 
				
			||||||
 | 
						EMPTY ("EMP"),
 | 
				
			||||||
 | 
						SCATTERED ("SCT"),
 | 
				
			||||||
 | 
						BUSY ("BSY"),
 | 
				
			||||||
 | 
						FULL ("FLL");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						String choice;
 | 
				
			||||||
 | 
						RatingChoices(String choice) { this.choice = choice; }
 | 
				
			||||||
 | 
						public String getValue() { return choice; }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,36 +0,0 @@
 | 
				
			|||||||
package com.uncc.gameday.registration;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.uncc.gameday.GameDay;
 | 
					 | 
				
			||||||
import com.uncc.gameday.R;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Client used for interfacing with the server API */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class RegistrationClient {
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private String serverName = GameDay.getAppContext().getString(R.string.server_hostname);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public void registerAttendee(Attendee a) {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public List<Attendee> listAttendeeNames() {
 | 
					 | 
				
			||||||
		// List all attendees to the game
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public List<Attendee> listAttendeeNames(int begin, int end) {
 | 
					 | 
				
			||||||
		// List attendees to the game supporting pagination
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public Attendee getAttendee(int id) {
 | 
					 | 
				
			||||||
		// Get the full information for a single attendee
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user