Saltar a contenido

Empresa

Recurso singleton client.company (endpoint company). Ver Numeraciones y empresa.

alegrapy.company.Company

Operations related to the company singleton endpoint (/company).

__init__(client)

Initialize the singleton resource with an explicit AlegraClient.

get(fields=None)

Retrieve company information.

Note

When multiple fields are passed, they are joined with ","; Alegra's documentation lists the enum values but does not state how multiple values are combined.

Parameters:

Name Type Description Default
fields str or Iterable[str]

Optional field(s) to request.

None

Returns:

Name Type Description
Any Any

Parsed JSON response for the company.

Raises:

Type Description
ValueError

If fields contains an unsupported value.

update(params)

Update company information (PUT /company).

Parameters:

Name Type Description Default
params dict

Fields to update.

required

Returns:

Name Type Description
Any Any

Parsed JSON response from the server.

Raises:

Type Description
ValueError

If params is not a dict.

Upload the company logo (POST /company/attachment).

Reads the entire image file into memory (no persistent file handle is kept) and sends it as multipart/form-data with type="logo". Multipart uploads are not retried by RetryPolicy.

Parameters:

Name Type Description Default
file_path str or PathLike

Path to an existing image file (image/*).

required

Returns:

Name Type Description
Any Any

Parsed JSON response from the server (e.g. {"file": ..., "type": "logo"}).

Raises:

Type Description
FileNotFoundError

If file_path does not exist.

ValueError

If file_path is not a regular file or its MIME type is not image/*.