Skip to main content
spelling cleanup
Source Link
gnat
  • 20.5k
  • 29
  • 117
  • 310

Handling multiple rest api versions within android java ClientAndroid Java client

Actual architecture

I have an app where a model is attached to every activity.The The model ask a repository for information that can come from server or local db depending on many factors.When When it asks server for information it creates a petition encapuslatedencapsulated under an object that goes to a webService Manager that process the request. The webService manager returns and errorEvent if somethings goes wrong and also handles the errors. where there is information it returns a genericEvent that comes with all the information retrieved from the server.

problemProblem

The server is going to next rest api version, with some improvmentsimprovements and features. The server is an engine configurable from the app, since every client has it's own server setup. somoSome clients will not update their servers to new version, and use the version from playstore. soSo I need to be able to handle different versions of restApi from the app, since there will be endpoints missing on older versions of server.

My alterantivealternative for solutions

I've changed the Interface that is each repository, to a abstract class that extends this inrfaceinterface. in order to create common calls, that can be overridedoverridden under each version. soSo every new version will inherit from the previusprevious one. with the necesarynecessary changes. thisThis way I'll be able to handle changes.

NOTE: that is stated that endpoint that retrieves server configuration and version, won't change in time. orOr at least in few years.

anyAny ideas about it?

Handling multiple rest api versions within android java Client

Actual architecture

I have an app where a model is attached to every activity.The model ask a repository for information that can come from server or local db depending on many factors.When it asks server for information it creates a petition encapuslated under an object that goes to a webService Manager that process the request. The webService manager returns and errorEvent if somethings goes wrong and also handles the errors. where there is information it returns a genericEvent that comes with all the information retrieved from the server.

problem

The server is going to next rest api version, with some improvments and features. The server is an engine configurable from the app, since every client has it's own server setup. somo clients will not update their servers to new version, and use the version from playstore. so I need to be able to handle different versions of restApi from the app, since there will be endpoints missing on older versions of server.

My alterantive for solutions

I've changed the Interface that is each repository, to a abstract class that extends this inrface. in order to create common calls, that can be overrided under each version. so every new version will inherit from the previus one. with the necesary changes. this way I'll be able to handle changes.

NOTE: that is stated that endpoint that retrieves server configuration and version, won't change in time. or at least in few years.

any ideas about it?

Handling multiple rest api versions within Android Java client

Actual architecture

I have an app where a model is attached to every activity. The model ask a repository for information that can come from server or local db depending on many factors. When it asks server for information it creates a petition encapsulated under an object that goes to a webService Manager that process the request. The webService manager returns and errorEvent if somethings goes wrong and also handles the errors. where there is information it returns a genericEvent that comes with all the information retrieved from the server.

Problem

The server is going to next rest api version, with some improvements and features. The server is an engine configurable from the app, since every client has it's own server setup. Some clients will not update their servers to new version, and use the version from playstore. So I need to be able to handle different versions of restApi from the app, since there will be endpoints missing on older versions of server.

My alternative for solutions

I've changed the Interface that is each repository, to a abstract class that extends this interface. in order to create common calls, that can be overridden under each version. So every new version will inherit from the previous one. with the necessary changes. This way I'll be able to handle changes.

NOTE: that is stated that endpoint that retrieves server configuration and version, won't change in time. Or at least in few years.

Any ideas about it?

Source Link

Handling multiple rest api versions within android java Client

Actual architecture

I have an app where a model is attached to every activity.The model ask a repository for information that can come from server or local db depending on many factors.When it asks server for information it creates a petition encapuslated under an object that goes to a webService Manager that process the request. The webService manager returns and errorEvent if somethings goes wrong and also handles the errors. where there is information it returns a genericEvent that comes with all the information retrieved from the server.

problem

The server is going to next rest api version, with some improvments and features. The server is an engine configurable from the app, since every client has it's own server setup. somo clients will not update their servers to new version, and use the version from playstore. so I need to be able to handle different versions of restApi from the app, since there will be endpoints missing on older versions of server.

My alterantive for solutions

I've changed the Interface that is each repository, to a abstract class that extends this inrface. in order to create common calls, that can be overrided under each version. so every new version will inherit from the previus one. with the necesary changes. this way I'll be able to handle changes.

NOTE: that is stated that endpoint that retrieves server configuration and version, won't change in time. or at least in few years.

any ideas about it?