File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,19 @@ class Detour extends Resource {
19
19
} ) ;
20
20
}
21
21
22
+ /**
23
+ * Fetches historical detours for a given customer.
24
+ * @param {Client } client Instance of pre-configured client
25
+ * @param {string } customerCode - The customer code.
26
+ * @returns {Promise<Array<Detour>> } A promise that resolves to an array of historical detours.
27
+ */
28
+ static async getHistoricalDetours ( client , customerCode ) {
29
+ const endpoint = `/2/${ customerCode } /serviceadjustments/detours/historical` ;
30
+ return this . client . get ( endpoint )
31
+ . then ( response => response . json ( ) )
32
+ . then ( detours => detours . map ( detour => new Detour ( client , detour ) ) ) ;
33
+ }
34
+
22
35
/**
23
36
* Makes a href for a given customer code and detour id
24
37
* @param {string } customerCode Customer code
@@ -43,7 +56,7 @@ class Detour extends Resource {
43
56
44
57
/**
45
58
* Create a new detour for a customer via the client.
46
- *
59
+ *
47
60
* @param {Object } data - The data object for creating a new detour.
48
61
* @param {number } data.patternId - The ID of the pattern associated with this detour.
49
62
* @param {number } data.detourPatternId - The ID of the detour pattern.
You can’t perform that action at this time.
0 commit comments