Added NotificationA PI
This commit is contained in:
parent
7795dd7efb
commit
196b1e3be2
@ -7,7 +7,7 @@ To re-generate http rune swagger
|
||||
YOu need swagger-codegen installed `brew install swagger-codegen`
|
||||
|
||||
```
|
||||
BASE=https://dev-06.iqser.cloud/
|
||||
BASE=https://red-staging.iqser.cloud/
|
||||
URL="$BASE"redaction-gateway-v1/v2/api-docs?group=redaction-gateway-v1
|
||||
rm -Rf /tmp/swagger
|
||||
mkdir -p /tmp/swagger
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { NotificationControllerService } from '@redaction/red-ui-http';
|
||||
|
||||
interface Notification {
|
||||
message: string;
|
||||
@ -27,7 +28,7 @@ export class NotificationsComponent {
|
||||
];
|
||||
groupedNotifications: { dateString: string; notifications: Notification[] }[] = [];
|
||||
|
||||
constructor(private _translateService: TranslateService) {
|
||||
constructor(private _translateService: TranslateService, private _notificationControllerService: NotificationControllerService) {
|
||||
this._groupNotifications();
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import { VersionsControllerService } from './api/versionsController.service';
|
||||
import { ViewedPagesControllerService } from './api/viewedPagesController.service';
|
||||
import { WatermarkControllerService } from './api/watermarkController.service';
|
||||
import { SearchControllerService } from './api/searchController.service';
|
||||
import { NotificationControllerService } from './api/notificationController.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
@ -61,7 +62,8 @@ import { SearchControllerService } from './api/searchController.service';
|
||||
VersionsControllerService,
|
||||
ViewedPagesControllerService,
|
||||
WatermarkControllerService,
|
||||
SearchControllerService
|
||||
SearchControllerService,
|
||||
NotificationControllerService
|
||||
]
|
||||
})
|
||||
export class ApiModule {
|
||||
|
||||
@ -26,6 +26,7 @@ import { UploadControllerService } from './uploadController.service';
|
||||
import { GeneralSettingsControllerService } from './generalSettingsController.service';
|
||||
import { DossierAttributesControllerService } from './dossierAttributesController.service';
|
||||
import { SearchControllerService } from './searchController.service';
|
||||
import { NotificationControllerService } from './notificationController.service';
|
||||
|
||||
export * from './auditController.service';
|
||||
|
||||
@ -83,6 +84,8 @@ export * from './dossierAttributesController.service';
|
||||
|
||||
export * from './searchController.service';
|
||||
|
||||
export * from './notificationController.service';
|
||||
|
||||
export const APIS = [
|
||||
AuditControllerService,
|
||||
DebugControllerService,
|
||||
@ -111,5 +114,6 @@ export const APIS = [
|
||||
UploadControllerService,
|
||||
GeneralSettingsControllerService,
|
||||
DossierAttributesControllerService,
|
||||
SearchControllerService
|
||||
SearchControllerService,
|
||||
NotificationControllerService
|
||||
];
|
||||
|
||||
303
libs/red-ui-http/src/lib/api/notificationController.service.ts
Normal file
303
libs/red-ui-http/src/lib/api/notificationController.service.ts
Normal file
@ -0,0 +1,303 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/ /* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
|
||||
import { CustomHttpUrlEncodingCodec } from '../encoder';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { NotificationResponse } from '../model/notificationResponse';
|
||||
|
||||
import { BASE_PATH } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
@Injectable()
|
||||
export class NotificationControllerService {
|
||||
protected basePath = '';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(
|
||||
protected httpClient: HttpClient,
|
||||
@Optional() @Inject(BASE_PATH) basePath: string,
|
||||
@Optional() configuration: Configuration
|
||||
) {
|
||||
if (basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param consumes string[] mime-types
|
||||
* @return true: consumes contains 'multipart/form-data', false: otherwise
|
||||
*/
|
||||
private canConsumeForm(consumes: string[]): boolean {
|
||||
const form = 'multipart/form-data';
|
||||
for (const consume of consumes) {
|
||||
if (form === consume) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete notifications
|
||||
* None
|
||||
* @param body notificationIds
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public deleteNotifications(body: Array<string>, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||
public deleteNotifications(body: Array<string>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
||||
public deleteNotifications(body: Array<string>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
||||
public deleteNotifications(body: Array<string>, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling deleteNotifications.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (RED-OAUTH) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken =
|
||||
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
return this.httpClient.request<any>('post', `${this.basePath}/notification/delete`, {
|
||||
body: body,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves notifications for the current user
|
||||
* None
|
||||
* @param includeSeen includeSeen
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getNotifications(includeSeen: boolean, observe?: 'body', reportProgress?: boolean): Observable<NotificationResponse>;
|
||||
public getNotifications(
|
||||
includeSeen: boolean,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<NotificationResponse>>;
|
||||
public getNotifications(
|
||||
includeSeen: boolean,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<NotificationResponse>>;
|
||||
public getNotifications(includeSeen: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||
if (includeSeen === null || includeSeen === undefined) {
|
||||
throw new Error('Required parameter includeSeen was null or undefined when calling getNotifications.');
|
||||
}
|
||||
|
||||
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
||||
if (includeSeen !== undefined && includeSeen !== null) {
|
||||
queryParameters = queryParameters.set('includeSeen', <any>includeSeen);
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (RED-OAUTH) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken =
|
||||
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = ['application/json'];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
return this.httpClient.request<NotificationResponse>('get', `${this.basePath}/notification`, {
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a notifications as read or unread
|
||||
* None
|
||||
* @param body notificationIds
|
||||
* @param setRead setRead
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public toggleNotificationRead(body: Array<string>, setRead: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||
public toggleNotificationRead(
|
||||
body: Array<string>,
|
||||
setRead: boolean,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<any>>;
|
||||
public toggleNotificationRead(
|
||||
body: Array<string>,
|
||||
setRead: boolean,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<any>>;
|
||||
public toggleNotificationRead(
|
||||
body: Array<string>,
|
||||
setRead: boolean,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false
|
||||
): Observable<any> {
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling toggleNotificationRead.');
|
||||
}
|
||||
|
||||
if (setRead === null || setRead === undefined) {
|
||||
throw new Error('Required parameter setRead was null or undefined when calling toggleNotificationRead.');
|
||||
}
|
||||
|
||||
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
||||
if (setRead !== undefined && setRead !== null) {
|
||||
queryParameters = queryParameters.set('setRead', <any>setRead);
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (RED-OAUTH) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken =
|
||||
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
return this.httpClient.request<any>('post', `${this.basePath}/notification/toggle-read`, {
|
||||
body: body,
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a notifications as seen or unseen
|
||||
* None
|
||||
* @param body notificationIds
|
||||
* @param setSeen setSeen
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public toggleNotificationSeen(body: Array<string>, setSeen: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||
public toggleNotificationSeen(
|
||||
body: Array<string>,
|
||||
setSeen: boolean,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<any>>;
|
||||
public toggleNotificationSeen(
|
||||
body: Array<string>,
|
||||
setSeen: boolean,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<any>>;
|
||||
public toggleNotificationSeen(
|
||||
body: Array<string>,
|
||||
setSeen: boolean,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false
|
||||
): Observable<any> {
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling toggleNotificationSeen.');
|
||||
}
|
||||
|
||||
if (setSeen === null || setSeen === undefined) {
|
||||
throw new Error('Required parameter setSeen was null or undefined when calling toggleNotificationSeen.');
|
||||
}
|
||||
|
||||
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
||||
if (setSeen !== undefined && setSeen !== null) {
|
||||
queryParameters = queryParameters.set('setSeen', <any>setSeen);
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (RED-OAUTH) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken =
|
||||
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
return this.httpClient.request<any>('post', `${this.basePath}/notification/toggle-seen`, {
|
||||
body: body,
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
}
|
||||
23
libs/red-ui-http/src/lib/model/notification.ts
Normal file
23
libs/red-ui-http/src/lib/model/notification.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface Notification {
|
||||
creationDate?: string;
|
||||
issuerId?: string;
|
||||
notificationId?: string;
|
||||
notificationType?: string;
|
||||
readDate?: string;
|
||||
seenDate?: string;
|
||||
softDeleted?: string;
|
||||
target?: any;
|
||||
userId?: string;
|
||||
}
|
||||
16
libs/red-ui-http/src/lib/model/notificationResponse.ts
Normal file
16
libs/red-ui-http/src/lib/model/notificationResponse.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Notification } from './notification';
|
||||
|
||||
export interface NotificationResponse {
|
||||
notifications?: Array<Notification>;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user