File tree 2 files changed +8
-1
lines changed 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ const detours = {
12
12
. get ( client . resolve ( '/2/SYNC/serviceadjustments/detours/historical' ) , historicalResponse )
13
13
. get ( client . resolve ( '/2/SYNC/serviceadjustments/detours/historical?startDate=2024-01-01T00:00:00.000Z' ) , historicalResponse )
14
14
. get ( client . resolve ( '/2/SYNC/serviceadjustments/detours/historical?startDate=2024-01-01T00:00:00.000Z&endDate=2024-02-01T00:00:00.000Z' ) , historicalResponse )
15
+ . get ( client . resolve ( '/2/SYNC/serviceadjustments/detours/historical?includeDeactivated=true' ) , historicalResponse )
16
+ . get ( client . resolve ( '/2/SYNC/serviceadjustments/detours/historical?startDate=2024-01-01T00:00:00.000Z&includeDeactivated=true' ) , historicalResponse )
17
+ . get ( client . resolve ( '/2/SYNC/serviceadjustments/detours/historical?startDate=2024-01-01T00:00:00.000Z&endDate=2024-02-01T00:00:00.000Z&includeDeactivated=true' ) , historicalResponse )
15
18
. post ( client . resolve ( '/2/SYNC/serviceadjustments/detours' ) , ( ) => singleResponse ( ) )
16
19
. delete ( client . resolve ( `/2/SYNC/serviceadjustments/detours/2` ) , ( ) => singleResponse ( ) )
17
20
} ,
Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ class Detour extends Resource {
23
23
* Fetches historical detours for a given customer.
24
24
* @param {Date } [startDate] - Optional start date to filter detours from (the date any applicable detours started)
25
25
* @param {Date } [endDate] - Optional end date to filter detours to (the date any applicable detours started)
26
+ * @param {boolean } [includeDeactivated=false] - Optional flag to include deactivated detours in the response
26
27
* @returns {Promise<Array<Detour>> } A promise that resolves to an array of historical detours.
27
28
*/
28
- async getHistoricalDetours ( startDate , endDate ) {
29
+ async getHistoricalDetours ( startDate , endDate , includeDeactivated = false ) {
29
30
const customerCode = this . href . split ( '/' ) [ 2 ] ; // Extract customer code from href
30
31
let endpoint = `/2/${ customerCode } /serviceadjustments/detours/historical` ;
31
32
@@ -36,6 +37,9 @@ class Detour extends Resource {
36
37
if ( endDate instanceof Date ) {
37
38
params . push ( `endDate=${ encodeURIComponent ( endDate . toISOString ( ) ) } ` ) ;
38
39
}
40
+ if ( includeDeactivated ) {
41
+ params . push ( 'includeDeactivated=true' ) ;
42
+ }
39
43
40
44
if ( params . length > 0 ) {
41
45
endpoint += `?${ params . join ( '&' ) } ` ;
You can’t perform that action at this time.
0 commit comments