@@ -23,7 +23,7 @@ public static function get_cache()
23
23
return $ items ;
24
24
}
25
25
26
- public static function overwite_cache (array $ data )
26
+ public static function overwrite_cache (array $ data )
27
27
{
28
28
$ cache_storage_key = static ::get_resource_instance ()->get_cache_storage_key ();
29
29
@@ -52,12 +52,14 @@ public static function update_cache(array $data)
52
52
}
53
53
}
54
54
55
- static ::overwite_cache ($ existing_items );
55
+ static ::overwrite_cache ($ existing_items );
56
56
}
57
57
58
58
public static function fetch_all ()
59
59
{
60
- $ passle_shortcodes = OptionsService::get ()->passle_shortcodes ;
60
+ $ options = OptionsService::get ();
61
+
62
+ $ passle_shortcodes = $ options ->passle_shortcodes ;
61
63
62
64
/** @var array[] $results */
63
65
$ results = array_map (fn ($ passle_shortcode ) => static ::fetch_all_by_passle ($ passle_shortcode ), $ passle_shortcodes );
@@ -75,25 +77,34 @@ public static function fetch_all()
75
77
// Set the default sync state to unsynced
76
78
array_walk ($ result , fn (&$ i ) => $ i ["SyncState " ] = 0 );
77
79
78
- static ::overwite_cache ($ result );
80
+ static ::overwrite_cache ($ result );
79
81
return $ result ;
80
82
} else {
81
- static ::overwite_cache (array ());
83
+ static ::overwrite_cache (array ());
82
84
return array ();
83
85
}
84
86
}
85
87
86
88
public static function fetch_all_by_passle (string $ passle_shortcode )
87
89
{
88
90
$ resource = static ::get_resource_instance ();
91
+ $ options = OptionsService::get ();
92
+
93
+ $ path = "passlesync/ {$ resource ->name_plural }" ;
94
+
95
+ $ parameters = array (
96
+ "PassleShortcode " => $ passle_shortcode ,
97
+ "ItemsPerPage " => "100 "
98
+ );
99
+
100
+ if ($ options ->include_passle_tag_groups ) {
101
+ $ parameters ["IncludeTagGroups " ] = "true " ;
102
+ }
89
103
90
104
$ url = (new UrlFactory ())
91
- ->path ("passlesync/ {$ resource ->name_plural }" )
92
- ->parameters ([
93
- "PassleShortcode " => $ passle_shortcode ,
94
- "ItemsPerPage " => "100 "
95
- ])
96
- ->build ();
105
+ ->path ($ path )
106
+ ->parameters ($ parameters )
107
+ ->build ();
97
108
98
109
$ responses = static ::get_all_paginated ($ url );
99
110
@@ -114,11 +125,16 @@ public static function fetch_by_shortcode(string $entity_shortcode)
114
125
public static function fetch_multiple_by_shortcode (array $ entity_shortcodes )
115
126
{
116
127
$ resource = static ::get_resource_instance ();
128
+ $ options = OptionsService::get ();
117
129
118
130
$ params = [
119
131
$ resource ->get_api_parameter_shortcode_name () => join (", " , $ entity_shortcodes )
120
132
];
121
133
134
+ if ($ options ->include_passle_tag_groups ) {
135
+ $ params ["IncludeTagGroups " ] = "true " ;
136
+ }
137
+
122
138
$ factory = new UrlFactory ();
123
139
$ url = $ factory
124
140
->path ("passlesync/ {$ resource ->name_plural }" )
0 commit comments