11# This file was auto-generated by Fern from our API Definition.
22
3+ import os
34import typing
45import urllib .parse
56from json .decoder import JSONDecodeError
@@ -46,7 +47,7 @@ class Fileforge:
4647
4748
4849
49- api_key : str
50+ header : typing.Optional[ str]
5051 timeout : typing.Optional[float]
5152 The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
5253
@@ -61,7 +62,7 @@ class Fileforge:
6162 from fileforge.client import Fileforge
6263
6364 client = Fileforge(
64- api_key="YOUR_API_KEY ",
65+ header="YOUR_HEADER ",
6566 )
6667 """
6768
@@ -70,15 +71,19 @@ def __init__(
7071 * ,
7172 base_url : typing .Optional [str ] = None ,
7273 environment : FileforgeEnvironment = FileforgeEnvironment .DEFAULT ,
73- api_key : str ,
74+ header : typing . Optional [ str ] = os . getenv ( "FILEFORGE_API_KEY" ) ,
7475 timeout : typing .Optional [float ] = None ,
7576 follow_redirects : typing .Optional [bool ] = True ,
7677 httpx_client : typing .Optional [httpx .Client ] = None ,
7778 ):
7879 _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
80+ if header is None :
81+ raise ApiError (
82+ body = "The client must be instantiated be either passing in header or setting FILEFORGE_API_KEY"
83+ )
7984 self ._client_wrapper = SyncClientWrapper (
8085 base_url = _get_base_url (base_url = base_url , environment = environment ),
81- api_key = api_key ,
86+ header = header ,
8287 httpx_client = httpx_client
8388 if httpx_client is not None
8489 else httpx .Client (timeout = _defaulted_timeout , follow_redirects = follow_redirects )
@@ -103,7 +108,7 @@ def retrieve_server_status(self, *, request_options: typing.Optional[RequestOpti
103108 from fileforge.client import Fileforge
104109
105110 client = Fileforge(
106- api_key="YOUR_API_KEY ",
111+ header="YOUR_HEADER ",
107112 )
108113 client.retrieve_server_status()
109114 """
@@ -206,7 +211,7 @@ def convert_docx(
206211 from fileforge.client import Fileforge
207212
208213 client = Fileforge(
209- api_key="YOUR_API_KEY ",
214+ header="YOUR_HEADER ",
210215 )
211216 client.convert_docx()
212217 """
@@ -287,7 +292,7 @@ def generate(
287292 from fileforge.client import Fileforge
288293
289294 client = Fileforge(
290- api_key="YOUR_API_KEY ",
295+ header="YOUR_HEADER ",
291296 )
292297 client.generate()
293298 """
@@ -367,7 +372,7 @@ def merge(
367372 from fileforge.client import Fileforge
368373
369374 client = Fileforge(
370- api_key="YOUR_API_KEY ",
375+ header="YOUR_HEADER ",
371376 )
372377 client.merge()
373378 """
@@ -436,7 +441,7 @@ class AsyncFileforge:
436441
437442
438443
439- api_key : str
444+ header : typing.Optional[ str]
440445 timeout : typing.Optional[float]
441446 The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
442447
@@ -451,7 +456,7 @@ class AsyncFileforge:
451456 from fileforge.client import AsyncFileforge
452457
453458 client = AsyncFileforge(
454- api_key="YOUR_API_KEY ",
459+ header="YOUR_HEADER ",
455460 )
456461 """
457462
@@ -460,15 +465,19 @@ def __init__(
460465 * ,
461466 base_url : typing .Optional [str ] = None ,
462467 environment : FileforgeEnvironment = FileforgeEnvironment .DEFAULT ,
463- api_key : str ,
468+ header : typing . Optional [ str ] = os . getenv ( "FILEFORGE_API_KEY" ) ,
464469 timeout : typing .Optional [float ] = None ,
465470 follow_redirects : typing .Optional [bool ] = True ,
466471 httpx_client : typing .Optional [httpx .AsyncClient ] = None ,
467472 ):
468473 _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
474+ if header is None :
475+ raise ApiError (
476+ body = "The client must be instantiated be either passing in header or setting FILEFORGE_API_KEY"
477+ )
469478 self ._client_wrapper = AsyncClientWrapper (
470479 base_url = _get_base_url (base_url = base_url , environment = environment ),
471- api_key = api_key ,
480+ header = header ,
472481 httpx_client = httpx_client
473482 if httpx_client is not None
474483 else httpx .AsyncClient (timeout = _defaulted_timeout , follow_redirects = follow_redirects )
@@ -493,7 +502,7 @@ async def retrieve_server_status(self, *, request_options: typing.Optional[Reque
493502 from fileforge.client import AsyncFileforge
494503
495504 client = AsyncFileforge(
496- api_key="YOUR_API_KEY ",
505+ header="YOUR_HEADER ",
497506 )
498507 await client.retrieve_server_status()
499508 """
@@ -596,7 +605,7 @@ async def convert_docx(
596605 from fileforge.client import AsyncFileforge
597606
598607 client = AsyncFileforge(
599- api_key="YOUR_API_KEY ",
608+ header="YOUR_HEADER ",
600609 )
601610 await client.convert_docx()
602611 """
@@ -677,7 +686,7 @@ async def generate(
677686 from fileforge.client import AsyncFileforge
678687
679688 client = AsyncFileforge(
680- api_key="YOUR_API_KEY ",
689+ header="YOUR_HEADER ",
681690 )
682691 await client.generate()
683692 """
@@ -757,7 +766,7 @@ async def merge(
757766 from fileforge.client import AsyncFileforge
758767
759768 client = AsyncFileforge(
760- api_key="YOUR_API_KEY ",
769+ header="YOUR_HEADER ",
761770 )
762771 await client.merge()
763772 """
0 commit comments