UNPKG

2.39 kBTypeScriptView Raw
1import { CookieOptionsProvider } from './cookie-options.provider';
2import { CookieDict, CookieOptions, ICookieService, ICookieWriterService } from './cookie.model';
3import * as i0 from "@angular/core";
4export declare class CookieService implements ICookieService {
5 private document;
6 private optionsProvider;
7 private cookieWriterService;
8 protected options: CookieOptions;
9 constructor(document: any, optionsProvider: CookieOptionsProvider, cookieWriterService: ICookieWriterService);
10 /**
11 * @description
12 * Returns if the given cookie key exists or not.
13 *
14 * @param key Id to use for lookup.
15 * @returns true if key exists, otherwise false.
16 */
17 hasKey(key: string): boolean;
18 /**
19 * @description
20 * Returns the value of given cookie key.
21 *
22 * @param key Id to use for lookup.
23 * @returns Raw cookie value.
24 */
25 get(key: string): string | undefined;
26 /**
27 * @description
28 * Returns the deserialized value of given cookie key.
29 *
30 * @param key Id to use for lookup.
31 * @returns Deserialized cookie value.
32 */
33 getObject(key: string): object | undefined;
34 /**
35 * @description
36 * Returns a key value object with all the cookies.
37 *
38 * @returns All cookies
39 */
40 getAll(): CookieDict;
41 /**
42 * @description
43 * Sets a value for given cookie key.
44 *
45 * @param key Id for the `value`.
46 * @param value Raw value to be stored.
47 * @param options (Optional) Options object.
48 */
49 put(key: string, value: string | undefined, options?: CookieOptions): void;
50 /**
51 * @description
52 * Serializes and sets a value for given cookie key.
53 *
54 * @param key Id for the `value`.
55 * @param value Value to be stored.
56 * @param options (Optional) Options object.
57 */
58 putObject(key: string, value: object, options?: CookieOptions): void;
59 /**
60 * @description
61 * Remove given cookie.
62 *
63 * @param key Id of the key-value pair to delete.
64 * @param options (Optional) Options object.
65 */
66 remove(key: string, options?: CookieOptions): void;
67 /**
68 * @description
69 * Remove all cookies.
70 */
71 removeAll(options?: CookieOptions): void;
72 static ɵfac: i0.ɵɵFactoryDeclaration<CookieService, never>;
73 static ɵprov: i0.ɵɵInjectableDeclaration<CookieService>;
74}