Noko Project Groups

The NokoClient offers multiple methods to interact with project_groups in Noko. On methods where keyword arguments are supported, parameter validation happens through Pydantic, allowing Python types other than what’s supported by the Noko API to be used when making requests, and providing a validation layer before the request is even made to the API.

class noko_client.client.NokoClient(access_token: str)

Simple Client for the Noko API.

Provide a friendlier interface to interact with the Noko API. Where Noko expects parameters to be passed in a specific way (for example, a list of strings for IDs, provide support for multiple types and handle formatting and validation.

This client does not currently support oAuth.

access_token

The Noko access token to authenticate the requests.

Type:

str

add_projects_to_group(project_group_id: str | int, project_ids: str | list[str | int]) list[dict]

Add projects to a project group.

Parameters:
  • project_group_id (str | int) – The ID of the project group to add projects to.

  • project_ids (str | list[str | int]) – A list of IDs of projects to add to the project group. If provided as a list, must be a comma separated list.

Returns:

A list of the projects added to the group.

Return type:

(list[dict])

create_project_group(**kwargs) list[dict]

Create a new project group.

Keyword Arguments:
  • name (str) – Name of the project group to be created.

  • project_ids (str | list) – A list of project IDs to associate with the new project group. A group cannot be created without at least one project associated with it.

Returns:

The newly created project group as a dictionary.

Return type:

(list[dict])

delete_project_group(project_group_id: str | int) None

Delete a project group.

When a project group is deleted, the projects in it are not deleted, instead, they remain without a group.

Parameters:

project_group_id (str | int) – The ID of the project group to delete.

Returns:

Does not return anything, if unsuccessful, raises an exception.

Return type:

(None)

edit_project_group(project_group_id: str | int, name: str) list[dict]

Edit a project group.

Parameters:
  • project_group_id (str | int) – The ID of the project group to edit.

  • name (str) – The name to give the project group.

Returns:

The updated project group as a dictionary.

Return type:

(list[dict])

get_all_entries_for_project_in_project_group(project_group_id: str | int, **kwargs) list[dict]

Retrieve all time entries associated with the projects in a project group.

Results can be filtered using the same keyword arguments as the ones used for the list entries endpoint. All keyword arguments are optional.

Parameters:

project_group_id (str | int) – The ID of the project group of the projects to retrieve entries for.

Keyword Arguments:
  • user_ids (str | list | None) – IDs of users to filter. If provided as a string, must be comma separated. If provided as a list, can be provided as a list of integers or strings. Defaults to None.

  • description (str | None) – Only descriptions containing the provided text will be returned. Defaults to None.

  • project_ids (str | list | None) – IDs of projects to filter for. If provided as a string, must be comma separated. If provided as a list, can be provided as a list of integers or strings. Defaults to None.

  • tag_ids (str | list | None) – IDs of users to filter for. If provided as a string, must be comma separated. If provided as a list, can be provided as a list of integers or strings. Defaults to None.

  • tag_filter_type (str | None) – The type of filter to apply if filtering for tag_ids. Defaults to None.

  • from (str | datetime | None) – The date from which to search. Only entries logged on this day onwards will be returned. If provided as string, must be in ISO 8601 format (YYYY-MM-DD).

  • to (str | datetime | None) – The date up to which to search. Only entries logged up to this day will be returned. If provided as string, must be in ISO 8601 format (YYYY-MM-DD).

  • invoiced (bool | str | None) – Whether to filter for invoiced or uninvoiced entries. If provided as string, must be lower case. Defaults to None.

  • updated_from (str | datetime | None) – Only entries with updates from this timestamp onwards are returned. If provided as string, must be in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Defaults to None.

  • updated_to (str | datetime | None) – Only entries with updates up to this timestamp are returned. If provided as string, must be in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Defaults to None.

  • billable (bool | str | None) – Whether to filter for billable or unbillable entries. If provided as string, must be lower case. Defaults to None.

  • approved_at_from (str | datetime | None) – Only entries with approvals from this date on will be returned. If provided as string, must be in ISO 8601 format (YYYY-MM-DD). Defaults to None.

  • approved_at_to (str | datetime | None) – Only entries with approvals up to this date will be returned. If provided as string, must be in ISO 8601 format (YYYY-MM-DD). Defaults to None.

Returns:

A list of all retrieved entries meeting the specified criteria.

Return type:

(list[dict])

get_all_projects_in_project_group(project_group_id: str | int, **kwargs) list[dict]

Retrieve all projects in a project group.

Results can be filtered using the same keyword arguments as the ones used for the list projects endpoint. All keyword arguments are optional.

Parameters:

project_group_id (str | int) – The ID of the project group of the projects to retrieve.

Keyword Arguments:
  • name (str | None) – Only projects containing this string in the name are returned. Defaults to None.

  • project_group_ids (str | list | None) – Only projects belonging to the group IDs provided are returned. Accepts a comma separated string of IDs or a list of IDs. Defaults to None.

  • billing_increment (int | None) – Only projects with the specified billing increment are returned. Accepted values: 1, 5, 6, 10, 15, 20, 30, 60. Defaults to None.

  • enabled (bool | None) – Return only active or inactive projects. Defaults to None.

  • billable (bool | None) – Return only billable or unbillable projects. Defaults to None.

Returns:

A list of all retrieved projects meeting the specified criteria.

Return type:

(list[dict])

get_single_project_group(project_group_id: str | int) list[dict]

Retrieve a single project group.

Parameters:

project_group_id (str | int) – The ID of the project group to retrieve.

Returns:

The project group retrieved as a dictionary.

Return type:

(list[dict])

list_project_groups(**kwargs) list[dict]

List all project groups from Noko.

Keyword Arguments:
  • name (str | None) – Only project groups with this string in the name are returned. Defaults to None.

  • project_ids (str | list | None) – A list of project IDs to filter by. If provided as a string, must be a comma separated list. Defaults to None.

Returns:

The retrieved Noko project groups as a list of dictionaries.

Return type:

(list[dict] | None)

remove_all_projects_from_group(project_group_id: str | int) None

Remove all projects from a project group.

Parameters:

project_group_id (str | int) – The ID of the project group to remove all projects from.

Returns:

Does not return anything, if unsuccessful, raises an exception.

Return type:

(None)

remove_projects_from_group(project_group_id: str | int, project_ids: str | list[str | int]) None

Remove projects from a project group.

Parameters:
  • project_group_id (str | int) – The ID of the project group to remove projects from.

  • project_ids (str | list[str | int]) – A list of IDs of projects to remove from the project group. If provided as a list, must be a comma separated list.

Returns:

Does not return anything, if unsuccessful, raises an exception.

Return type:

(None)