@@ -62,14 +62,14 @@ class ImageKit(SyncAPIClient):
6262 with_streaming_response : ImageKitWithStreamedResponse
6363
6464 # client options
65- private_api_key : str
65+ private_key : str
6666 password : str | None
6767 webhook_secret : str | None
6868
6969 def __init__ (
7070 self ,
7171 * ,
72- private_api_key : str | None = None ,
72+ private_key : str | None = None ,
7373 password : str | None = None ,
7474 webhook_secret : str | None = None ,
7575 base_url : str | httpx .URL | None = None ,
@@ -94,17 +94,17 @@ def __init__(
9494 """Construct a new synchronous ImageKit client instance.
9595
9696 This automatically infers the following arguments from their corresponding environment variables if they are not provided:
97- - `private_api_key ` from `IMAGEKIT_PRIVATE_API_KEY`
97+ - `private_key ` from `IMAGEKIT_PRIVATE_API_KEY`
9898 - `password` from `OPTIONAL_IMAGEKIT_IGNORES_THIS`
9999 - `webhook_secret` from `IMAGEKIT_WEBHOOK_SECRET`
100100 """
101- if private_api_key is None :
102- private_api_key = os .environ .get ("IMAGEKIT_PRIVATE_API_KEY" )
103- if private_api_key is None :
101+ if private_key is None :
102+ private_key = os .environ .get ("IMAGEKIT_PRIVATE_API_KEY" )
103+ if private_key is None :
104104 raise ImageKitError (
105- "The private_api_key client option must be set either by passing private_api_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable"
105+ "The private_key client option must be set either by passing private_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable"
106106 )
107- self .private_api_key = private_api_key
107+ self .private_key = private_key
108108
109109 if password is None :
110110 password = os .environ .get ("OPTIONAL_IMAGEKIT_IGNORES_THIS" ) or "do_not_set"
@@ -152,7 +152,7 @@ def qs(self) -> Querystring:
152152 def auth_headers (self ) -> dict [str , str ]:
153153 if self .password is None :
154154 return {}
155- credentials = f"{ self .private_api_key } :{ self .password } " .encode ("ascii" )
155+ credentials = f"{ self .private_key } :{ self .password } " .encode ("ascii" )
156156 header = f"Basic { base64 .b64encode (credentials ).decode ('ascii' )} "
157157 return {"Authorization" : header }
158158
@@ -167,19 +167,19 @@ def default_headers(self) -> dict[str, str | Omit]:
167167
168168 @override
169169 def _validate_headers (self , headers : Headers , custom_headers : Headers ) -> None :
170- if self .private_api_key and self .password and headers .get ("Authorization" ):
170+ if self .private_key and self .password and headers .get ("Authorization" ):
171171 return
172172 if isinstance (custom_headers .get ("Authorization" ), Omit ):
173173 return
174174
175175 raise TypeError (
176- '"Could not resolve authentication method. Expected the private_api_key or password to be set. Or for the `Authorization` headers to be explicitly omitted"'
176+ '"Could not resolve authentication method. Expected the private_key or password to be set. Or for the `Authorization` headers to be explicitly omitted"'
177177 )
178178
179179 def copy (
180180 self ,
181181 * ,
182- private_api_key : str | None = None ,
182+ private_key : str | None = None ,
183183 password : str | None = None ,
184184 webhook_secret : str | None = None ,
185185 base_url : str | httpx .URL | None = None ,
@@ -215,7 +215,7 @@ def copy(
215215
216216 http_client = http_client or self ._client
217217 client = self .__class__ (
218- private_api_key = private_api_key or self .private_api_key ,
218+ private_key = private_key or self .private_key ,
219219 password = password or self .password ,
220220 webhook_secret = webhook_secret or self .webhook_secret ,
221221 base_url = base_url or self .base_url ,
@@ -280,14 +280,14 @@ class AsyncImageKit(AsyncAPIClient):
280280 with_streaming_response : AsyncImageKitWithStreamedResponse
281281
282282 # client options
283- private_api_key : str
283+ private_key : str
284284 password : str | None
285285 webhook_secret : str | None
286286
287287 def __init__ (
288288 self ,
289289 * ,
290- private_api_key : str | None = None ,
290+ private_key : str | None = None ,
291291 password : str | None = None ,
292292 webhook_secret : str | None = None ,
293293 base_url : str | httpx .URL | None = None ,
@@ -312,17 +312,17 @@ def __init__(
312312 """Construct a new async AsyncImageKit client instance.
313313
314314 This automatically infers the following arguments from their corresponding environment variables if they are not provided:
315- - `private_api_key ` from `IMAGEKIT_PRIVATE_API_KEY`
315+ - `private_key ` from `IMAGEKIT_PRIVATE_API_KEY`
316316 - `password` from `OPTIONAL_IMAGEKIT_IGNORES_THIS`
317317 - `webhook_secret` from `IMAGEKIT_WEBHOOK_SECRET`
318318 """
319- if private_api_key is None :
320- private_api_key = os .environ .get ("IMAGEKIT_PRIVATE_API_KEY" )
321- if private_api_key is None :
319+ if private_key is None :
320+ private_key = os .environ .get ("IMAGEKIT_PRIVATE_API_KEY" )
321+ if private_key is None :
322322 raise ImageKitError (
323- "The private_api_key client option must be set either by passing private_api_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable"
323+ "The private_key client option must be set either by passing private_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable"
324324 )
325- self .private_api_key = private_api_key
325+ self .private_key = private_key
326326
327327 if password is None :
328328 password = os .environ .get ("OPTIONAL_IMAGEKIT_IGNORES_THIS" ) or "do_not_set"
@@ -370,7 +370,7 @@ def qs(self) -> Querystring:
370370 def auth_headers (self ) -> dict [str , str ]:
371371 if self .password is None :
372372 return {}
373- credentials = f"{ self .private_api_key } :{ self .password } " .encode ("ascii" )
373+ credentials = f"{ self .private_key } :{ self .password } " .encode ("ascii" )
374374 header = f"Basic { base64 .b64encode (credentials ).decode ('ascii' )} "
375375 return {"Authorization" : header }
376376
@@ -385,19 +385,19 @@ def default_headers(self) -> dict[str, str | Omit]:
385385
386386 @override
387387 def _validate_headers (self , headers : Headers , custom_headers : Headers ) -> None :
388- if self .private_api_key and self .password and headers .get ("Authorization" ):
388+ if self .private_key and self .password and headers .get ("Authorization" ):
389389 return
390390 if isinstance (custom_headers .get ("Authorization" ), Omit ):
391391 return
392392
393393 raise TypeError (
394- '"Could not resolve authentication method. Expected the private_api_key or password to be set. Or for the `Authorization` headers to be explicitly omitted"'
394+ '"Could not resolve authentication method. Expected the private_key or password to be set. Or for the `Authorization` headers to be explicitly omitted"'
395395 )
396396
397397 def copy (
398398 self ,
399399 * ,
400- private_api_key : str | None = None ,
400+ private_key : str | None = None ,
401401 password : str | None = None ,
402402 webhook_secret : str | None = None ,
403403 base_url : str | httpx .URL | None = None ,
@@ -433,7 +433,7 @@ def copy(
433433
434434 http_client = http_client or self ._client
435435 client = self .__class__ (
436- private_api_key = private_api_key or self .private_api_key ,
436+ private_key = private_key or self .private_key ,
437437 password = password or self .password ,
438438 webhook_secret = webhook_secret or self .webhook_secret ,
439439 base_url = base_url or self .base_url ,
0 commit comments