@@ -50,7 +50,7 @@ class VitessceConfigDatasetFile:
5050 A class to represent a file (described by a URL, data type, and file type) in a Vitessce view config dataset.
5151 """
5252
53- def __init__ (self , file_type , url = None , coordination_values = None , options = None , data_type = None ):
53+ def __init__ (self , file_type , url = None , coordination_values = None , options = None , data_type = None , request_init = None ):
5454 """
5555 Not meant to be instantiated directly, but instead created and returned by the ``VitessceConfigDataset.add_file()`` method.
5656
@@ -62,6 +62,8 @@ def __init__(self, file_type, url=None, coordination_values=None, options=None,
6262 :param options: Extra options to pass to the file loader class.
6363 :type options: dict or list or None
6464 :param data_type: Deprecated / not used. Only included for backwards compatibility with the old API.
65+ :param request_init: Optional request init object to pass to the fetch API.
66+ :type request_init: dict or None
6567 """
6668 self .file = {
6769 "fileType" : file_type
@@ -72,6 +74,8 @@ def __init__(self, file_type, url=None, coordination_values=None, options=None,
7274 self .file ["options" ] = options
7375 if coordination_values :
7476 self .file ["coordinationValues" ] = coordination_values
77+ if request_init :
78+ self .file ["requestInit" ] = request_init
7579
7680 def __repr__ (self ):
7781 repr_dict = {
@@ -83,6 +87,8 @@ def __repr__(self):
8387 repr_dict ["coordination_values" ] = self .file ["coordinationValues" ]
8488 if "options" in self .file :
8589 repr_dict ["options" ] = self .file ["options" ]
90+ if "requestInit" in self .file :
91+ repr_dict ["request_init" ] = self .file ["requestInit" ]
8692
8793 return make_repr (repr_dict , class_def = self .__class__ )
8894
@@ -135,7 +141,7 @@ def get_uid(self):
135141 """
136142 return self .dataset ["uid" ]
137143
138- def add_file (self , file_type , url = None , coordination_values = None , options = None , data_type = None ):
144+ def add_file (self , file_type , url = None , coordination_values = None , options = None , data_type = None , request_init = None ):
139145 """
140146 Add a new file definition to this dataset instance.
141147
@@ -148,6 +154,8 @@ def add_file(self, file_type, url=None, coordination_values=None, options=None,
148154 :param options: Extra options to pass to the file loader class. Optional.
149155 :type options: dict or list or None
150156 :param data_type: Deprecated / not used. Only included for backwards compatibility with the old API.
157+ :param request_init: Optional request init object to pass to the fetch API.
158+ :type request_init: dict or None
151159
152160 :returns: Self, to allow function chaining.
153161 :rtype: VitessceConfigDataset
@@ -171,7 +179,7 @@ def add_file(self, file_type, url=None, coordination_values=None, options=None,
171179 file_type_str = norm_enum (file_type , ft )
172180
173181 self ._add_file (VitessceConfigDatasetFile (
174- url = url , file_type = file_type_str , coordination_values = coordination_values , options = options ))
182+ url = url , file_type = file_type_str , coordination_values = coordination_values , options = options , request_init = request_init ))
175183 return self
176184
177185 def _add_file (self , obj ):
@@ -1606,7 +1614,8 @@ def from_dict(config):
16061614 file_type = f ["fileType" ],
16071615 url = f .get ("url" ),
16081616 coordination_values = f .get ("coordinationValues" ),
1609- options = f .get ("options" )
1617+ options = f .get ("options" ),
1618+ request_init = f .get ("requestInit" )
16101619 )
16111620 if 'coordinationSpace' in config :
16121621 for c_type in config ['coordinationSpace' ].keys ():
0 commit comments