-
-
Notifications
You must be signed in to change notification settings - Fork 14
Api Config
Diego van Haaster edited this page Mar 18, 2022
·
18 revisions
import { ApiConfig, EDM_PARSERS, ODataInStorageCache } from 'angular-odata';
//#region ODataApi Imports
import { NorthwindModelSchema } from './NorthwindModel/northwindmodel.schema';
import { ModelSchema } from './ODataWebExperimental/Northwind/Model/model.schema';
//#endregion
export const NorthwindConfig = {
serviceRootUrl: 'https://services.odata.org/V4/Northwind/Northwind.svc/',
name: 'Northwind',
// '4.0', '3.0', '2.0'
version: '4.0',
creation: new Date(),
default: true,
cache: new ODataInMemoryCache({timeout: 60}),
errorHandler: (error: HttpErrorResponse) => {
if (error.status === 400) {
let odataError = // Handle OData Server Errors
return throwError(odataError);
}
return throwError(error);
},
options: {
stringAsEnum: true,
withCredentials: true,
headers: {...},
params: {...},
// 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only'
fetchPolicy: 'cache-and-network',
etag: {
ifMatch: true,
ifNoneMatch: false
},
accept: {
// 'minimal' | 'full' | 'none'
metadata: 'minimal',
ieee754Compatible: true,
},
prefer: {
maxPageSize: 10,
return: 'representation',
continueOnError: false,
includeAnnotations: '*'
},
stripMetadata: 'minimal',
bodyQueryOptions: ['filter', 'select'],
deleteRefBy: 'path',
nonParenthesisForEmptyParameterFunction: false
},
schemas: [
NorthwindModelSchema,
ModelSchema
],
parsers: EDM_PARSERS
} as ApiConfig;