com.mx.path.model.mdx.web.controller.AccountAlertsController Maven / Gradle / Ivy
The newest version!
package com.mx.path.model.mdx.web.controller;
import com.mx.path.gateway.accessor.AccessorResponse;
import com.mx.path.model.mdx.model.MdxList;
import com.mx.path.model.mdx.model.account.Account;
import com.mx.path.model.mdx.model.account.alerts.AccountAlert;
import com.mx.path.model.mdx.model.account.alerts.DeliveryMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "{clientId}")
public class AccountAlertsController extends BaseController {
@RequestMapping(value = "/users/{userId}/accounts/{accountId}/alerts/{id}", method = RequestMethod.GET)
public final ResponseEntity getAlert(@PathVariable("accountId") String accountId, @PathVariable("id") String alertId) {
ensureFeature("accounts");
AccessorResponse response = gateway().accounts().accountAlerts().get(accountId, alertId);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/accounts/{accountId}/alerts", method = RequestMethod.GET, produces = BaseController.MDX_MEDIA)
public final ResponseEntity> getAlertList(@PathVariable("accountId") String accountId) {
ensureFeature("accounts");
AccessorResponse> response = gateway().accounts().accountAlerts().list(accountId);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/accounts/{accountId}/alerts/{id}", method = RequestMethod.PUT, consumes = BaseController.MDX_MEDIA)
public final ResponseEntity updateAlert(@PathVariable("accountId") String accountId, @RequestBody AccountAlert accountAlert) {
ensureFeature("accounts");
AccessorResponse response = gateway().accounts().accountAlerts().update(accountId, accountAlert);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/accounts/{accountId}/alerts/{id}/delivery_methods", method = RequestMethod.GET, produces = BaseController.MDX_MEDIA)
public final ResponseEntity> getDeliveryMethods(@PathVariable("accountId") String accountId, @PathVariable("id") String alertId) {
ensureFeature("accounts");
AccessorResponse> response = gateway().accounts().accountAlerts().deliveryMethods(accountId, alertId);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
@RequestMapping(value = "/users/{userId}/accounts/alert", method = RequestMethod.GET, produces = BaseController.MDX_MEDIA)
public final ResponseEntity> getAccounts() {
ensureFeature("accounts");
AccessorResponse> response = gateway().accounts().accountAlerts().accounts();
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy