Skip to content

Commit 1ef2a78

Browse files
committed
Update documentation
1 parent 2691a95 commit 1ef2a78

File tree

2 files changed

+37
-38
lines changed

2 files changed

+37
-38
lines changed

API_Reference.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
- [Content Types](#content-types)
66
- [Error Messages](#error-messages)
77
- [`Interfaces`](#interfaces)
8-
- [libak_RestFramework.IRestResponse](#restframeworkirestresponse)
9-
- [libak_RestFramework.IErrorResponseFactory](#restframeworkierrorresponsefactory)
10-
- [libak_RestFramework.IRestLogger](#restframeworkirestlogger)
8+
- [libak_IRestResponse](#restframeworkirestresponse)
9+
- [libak_IErrorResponseFactory](#restframeworkierrorresponsefactory)
10+
- [libak_IRestLogger](#restframeworkirestlogger)
1111
- [`Public static methods`](#public-static-methods)
1212
- [`handleRequest(Type routerType)`](#handlerequesttype-routertype)
1313
- [`handleRequest(Type routerType, Type loggerType)`](#handlerequesttype-routertype-type-loggertype)
@@ -19,8 +19,8 @@
1919
- [`process()`](#process)
2020
- [`useUriTemplate(String uriTemplate)`](#useuritemplatestring-uritemplate)
2121
- [`useRestRequest(RestRequest request)`](#userestrequestrestrequest-request)
22-
- [`useErrorResponseFactory(libak_RestFramework.IErrorResponseFactory errorResponseFactory)`](#useerrorresponsefactoryrestframeworkierrorresponsefactory-errorresponsefactory)
23-
- [`useRestLogger(libak_RestFramework.IRestLogger restLogger)`](#userestloggerrestframeworkirestlogger-restlogger)
22+
- [`useErrorResponseFactory(libak_IErrorResponseFactory errorResponseFactory)`](#useerrorresponsefactoryrestframeworkierrorresponsefactory-errorresponsefactory)
23+
- [`useRestLogger(libak_IRestLogger restLogger)`](#userestloggerrestframeworkirestlogger-restlogger)
2424
- [Virtual Methods](#virtual-methods)
2525
- [`handleGet()`](#handleget)
2626
- [`handlePost()`](#handlepost)
@@ -38,7 +38,7 @@
3838
- [Abstract methods](#abstract-methods)
3939
- [`setRoutes()`](#setroutes)
4040
- [Public methods](#public-methods-1)
41-
- [`newRestProcessor(RestRequest request, libak_RestFramework.IErrorResponseFactory errorResponseFactory, libak_RestFramework.IRestLogger restLogger)`](#newrestprocessorrestrequest-request-restframeworkierrorresponsefactory-errorresponsefactory-restframeworkirestlogger-restlogger)
41+
- [`newRestProcessor(RestRequest request, libak_IErrorResponseFactory errorResponseFactory, libak_IRestLogger restLogger)`](#newrestprocessorrestrequest-request-restframeworkierrorresponsefactory-errorresponsefactory-restframeworkirestlogger-restlogger)
4242
- [Private Methods](#private-methods-1)
4343
- [`isRouteExists(String route, String requestURI)`](#isrouteexistsstring-route-string-requesturi)
4444
- [`libak_ErrorResponseFactory class`](#errorresponsefactory-class)
@@ -106,21 +106,21 @@ The `libak_RestFramework` class provides a structured framework for building RES
106106

107107
## `Interfaces`
108108

109-
### libak_RestFramework.IRestResponse
109+
### libak_IRestResponse
110110

111-
The `libak_RestFramework.IRestResponse` interface defines a method for sending REST responses.
111+
The `libak_IRestResponse` interface defines a method for sending REST responses.
112112

113113
- `sendResponse(): void`: Sends the REST response.
114114

115-
### libak_RestFramework.IErrorResponseFactory
115+
### libak_IErrorResponseFactory
116116

117-
The `libak_RestFramework.IErrorResponseFactory` interface defines a method for creating error responses.
117+
The `libak_IErrorResponseFactory` interface defines a method for creating error responses.
118118

119-
- `newErrorRestResponse(Exception exc): libak_RestFramework.IRestResponse`: Creates a new error response based on the given exception.
119+
- `newErrorRestResponse(Exception exc): libak_IRestResponse`: Creates a new error response based on the given exception.
120120

121-
### libak_RestFramework.IRestLogger
121+
### libak_IRestLogger
122122

123-
The `libak_RestFramework.IRestLogger` interface defines methods for logging REST-related information.
123+
The `libak_IRestLogger` interface defines methods for logging REST-related information.
124124

125125
- `addErrorDetails(Exception exc): void`: Adds error details to the logger.
126126
- `createLog(): void`: Creates a log.
@@ -172,7 +172,7 @@ Processes the incoming REST request by handling different HTTP methods and manag
172172

173173
This method is the entry point for processing incoming REST requests. It dynamically dispatches the request to the appropriate handler based on the HTTP method (GET, POST, PUT, PATCH, DELETE). If an unsupported HTTP method is received, it throws a `libak_RestFramework.MethodNotAllowedException`.
174174

175-
- Returns: An instance of `libak_RestFramework.IRestResponse` representing the response to the REST request.
175+
- Returns: An instance of `libak_IRestResponse` representing the response to the REST request.
176176
- Throws: `libak_RestFramework.MethodNotAllowedException` - If the incoming HTTP method is not supported for this resource.
177177

178178
#### `useUriTemplate(String uriTemplate)`
@@ -191,20 +191,20 @@ Sets the REST request for this `libak_RestProcessor`. The REST request contains
191191
- `request` (RestRequest): The `RestRequest` object representing the incoming HTTP request.
192192
- Returns: The current `libak_RestProcessor` instance with the specified REST request set.
193193

194-
#### `useErrorResponseFactory(libak_RestFramework.IErrorResponseFactory errorResponseFactory)`
194+
#### `useErrorResponseFactory(libak_IErrorResponseFactory errorResponseFactory)`
195195

196196
Sets the error response factory for this `libak_RestProcessor`.
197197

198198
- Parameters:
199-
- `errorResponseFactory` (libak_RestFramework.IErrorResponseFactory): The error response factory to use.
199+
- `errorResponseFactory` (libak_IErrorResponseFactory): The error response factory to use.
200200
- Returns: The current `libak_RestProcessor` instance.
201201

202-
#### `useRestLogger(libak_RestFramework.IRestLogger restLogger)`
202+
#### `useRestLogger(libak_IRestLogger restLogger)`
203203

204204
Sets the REST logger for this `libak_RestProcessor`.
205205

206206
- Parameters:
207-
- `restLogger` (libak_RestFramework.IRestLogger): The REST logger to use.
207+
- `restLogger` (libak_IRestLogger): The REST logger to use.
208208
- Returns: The current `libak_RestProcessor` instance.
209209

210210
### Virtual Methods
@@ -215,31 +215,31 @@ The `libak_RestProcessor` class includes a set of virtual methods for handling s
215215

216216
Handles the HTTP GET method for processing REST requests.
217217

218-
- Returns: An instance of `libak_RestFramework.IRestResponse` representing the response to the GET request.
218+
- Returns: An instance of `libak_IRestResponse` representing the response to the GET request.
219219

220220
#### `handlePost()`
221221

222222
Handles the HTTP POST method for processing REST requests.
223223

224-
- Returns: An instance of `libak_RestFramework.IRestResponse` representing the response to the POST request.
224+
- Returns: An instance of `libak_IRestResponse` representing the response to the POST request.
225225

226226
#### `handlePut()`
227227

228228
Handles the HTTP PUT method for processing REST requests.
229229

230-
- Returns: An instance of `libak_RestFramework.IRestResponse` representing the response to the PUT request.
230+
- Returns: An instance of `libak_IRestResponse` representing the response to the PUT request.
231231

232232
#### `handlePatch()`
233233

234234
Handles the HTTP PATCH method for processing REST requests.
235235

236-
- Returns: An instance of `libak_RestFramework.IRestResponse` representing the response to the PATCH request.
236+
- Returns: An instance of `libak_IRestResponse` representing the response to the PATCH request.
237237

238238
#### `handleDelete()`
239239

240240
Handles the HTTP DELETE method for processing REST requests.
241241

242-
- Returns: An instance of `libak_RestFramework.IRestResponse` representing the response to the DELETE request.
242+
- Returns: An instance of `libak_IRestResponse` representing the response to the DELETE request.
243243

244244
### Protected Methods
245245

@@ -300,14 +300,14 @@ Sets the routes for the `libak_RestRouter`. Implement this method to define the
300300

301301
### Public methods
302302

303-
#### `newRestProcessor(RestRequest request, libak_RestFramework.IErrorResponseFactory errorResponseFactory, libak_RestFramework.IRestLogger restLogger)`
303+
#### `newRestProcessor(RestRequest request, libak_IErrorResponseFactory errorResponseFactory, libak_IRestLogger restLogger)`
304304

305305
Creates a new `libak_RestProcessor` instance for handling the incoming REST request with a custom error response factory and REST logger. This method dynamically selects the appropriate `libak_RestProcessor` based on the requested URI.
306306

307307
- Parameters:
308308
- `request` (RestRequest): The `RestRequest` object representing the incoming HTTP request.
309-
- `errorResponseFactory` (libak_RestFramework.IErrorResponseFactory): The custom error response factory to use for generating error responses.
310-
- `restLogger` (libak_RestFramework.IRestLogger): The custom REST logger to use for logging REST-related information.
309+
- `errorResponseFactory` (libak_IErrorResponseFactory): The custom error response factory to use for generating error responses.
310+
- `restLogger` (libak_IRestLogger): The custom REST logger to use for logging REST-related information.
311311
- Returns: A new `libak_RestProcessor` instance configured to handle the specified REST request with custom error handling and logging.
312312
- Throws: `libak_RestFramework.InvalidUriException` - If the requested URI does not match any defined routes.
313313

@@ -497,5 +497,4 @@ Sends the error response with the configured status code, summary, and details.
497497
## `Custom Exceptions`
498498

499499
- `libak_RestFramework.InvalidUriException`: Exception class for invalid URIs.
500-
- `libak_RestFramework.NotFoundException`: Exception class for not found resources.
501500
- `libak_RestFramework.MethodNotAllowedException`: Exception class for unsupported HTTP methods.

Developer_Guide.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Here is a few things you have to consider about it:
169169
- PATCH -> handlePatch()
170170
- DELETE -> handleDelete()
171171

172-
All these methods have to return the `libak_RestFramework.IRestResponse`.
172+
All these methods have to return the `libak_IRestResponse`.
173173
- the `libak_RestProcessor` provides set of methods to easily get access to URI params, query params, and headers:
174174
- `getUriParam(String paramName)` - remember about the colon character `:` we saw in the routes? It allows us to use those "variable" names to take the proper URI param like this: `this.getUriParam('customer_sf_id')`
175175
- `getQueryParam(String paramName)`
@@ -180,7 +180,7 @@ Now we know good enough at this stage to prepare our Rest Processors
180180
```java
181181
// Here you can see there is no pagination implementation. We will add it later to show the versioning functionality.
182182
public class CustomersProcessorV1 extends libak_RestProcessor {
183-
protected override libak_RestFramework.IRestResponse handleGet() {
183+
protected override libak_IRestResponse handleGet() {
184184
List<Account> accounts = [
185185
SELECT Id, Name, Phone, BillingStreet, BillingCity, BillingState, BillingPostalCode
186186
FROM Account
@@ -194,7 +194,7 @@ public class CustomersProcessorV1 extends libak_RestProcessor {
194194
}
195195
}
196196

197-
protected override libak_RestFramework.IRestResponse handlePost() {
197+
protected override libak_IRestResponse handlePost() {
198198
Account newAccount = (Account)JSON.deserialize(this.request.requestBody.toString(), Account.class);
199199
insert newAccount;
200200

@@ -205,7 +205,7 @@ public class CustomersProcessorV1 extends libak_RestProcessor {
205205

206206
```java
207207
public class CustomerProcessorV1 extends libak_RestProcessor {
208-
protected override libak_RestFramework.IRestResponse handleGet() {
208+
protected override libak_IRestResponse handleGet() {
209209
List<Account> accounts = [
210210
SELECT Id, Name, Phone, BillingStreet, BillingCity, BillingState, BillingPostalCode
211211
FROM Account
@@ -219,7 +219,7 @@ public class CustomerProcessorV1 extends libak_RestProcessor {
219219
}
220220
}
221221

222-
protected override libak_RestFramework.IRestResponse handlePut() {
222+
protected override libak_IRestResponse handlePut() {
223223
String accountId = this.getUriParam('customer_sf_id');
224224
List<Account> existingAccounts = [SELECT Id FROM Account WHERE Id = :accountId];
225225

@@ -233,7 +233,7 @@ public class CustomerProcessorV1 extends libak_RestProcessor {
233233
return new libak_JsonResponse(updatedAccount);
234234
}
235235

236-
protected override libak_RestFramework.IRestResponse handleDelete() {
236+
protected override libak_IRestResponse handleDelete() {
237237
String accountId = this.getUriParam('customer_sf_id');
238238
List<Account> existingAccounts = [SELECT Id FROM Account WHERE Id = :accountId];
239239

@@ -295,7 +295,7 @@ global with sharing class CustomerWebServiceDemo {
295295
}
296296

297297
public class CustomersProcessorV1 extends libak_RestProcessor {
298-
protected override libak_RestFramework.IRestResponse handleGet() {
298+
protected override libak_IRestResponse handleGet() {
299299
List<Account> accounts = [
300300
SELECT Id, Name, Phone, BillingStreet, BillingCity, BillingState, BillingPostalCode
301301
FROM Account
@@ -309,7 +309,7 @@ global with sharing class CustomerWebServiceDemo {
309309
}
310310
}
311311

312-
protected override libak_RestFramework.IRestResponse handlePost() {
312+
protected override libak_IRestResponse handlePost() {
313313
Account newAccount = (Account)JSON.deserialize(this.request.requestBody.toString(), Account.class);
314314
insert newAccount;
315315

@@ -318,7 +318,7 @@ global with sharing class CustomerWebServiceDemo {
318318
}
319319

320320
public class CustomerProcessorV1 extends libak_RestProcessor {
321-
protected override libak_RestFramework.IRestResponse handleGet() {
321+
protected override libak_IRestResponse handleGet() {
322322
List<Account> accounts = [
323323
SELECT Id, Name, Phone, BillingStreet, BillingCity, BillingState, BillingPostalCode
324324
FROM Account
@@ -332,7 +332,7 @@ global with sharing class CustomerWebServiceDemo {
332332
}
333333
}
334334

335-
protected override libak_RestFramework.IRestResponse handlePut() {
335+
protected override libak_IRestResponse handlePut() {
336336
String accountId = this.getUriParam('customer_sf_id');
337337
List<Account> existingAccounts = [SELECT Id FROM Account WHERE Id = :accountId];
338338

@@ -346,7 +346,7 @@ global with sharing class CustomerWebServiceDemo {
346346
return new libak_JsonResponse(updatedAccount);
347347
}
348348

349-
protected override libak_RestFramework.IRestResponse handleDelete() {
349+
protected override libak_IRestResponse handleDelete() {
350350
String accountId = this.getUriParam('customer_sf_id');
351351
List<Account> existingAccounts = [SELECT Id FROM Account WHERE Id = :accountId];
352352

0 commit comments

Comments
 (0)