gusto_api/
custom_fields.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct CustomFields {
5    pub client: Client,
6}
7
8impl CustomFields {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        CustomFields { client }
12    }
13
14    /**
15     * Get an employee's custom fields.
16     *
17     * This function performs a `GET` to the `/v1/employees/{employee_id}/custom_fields` endpoint.
18     *
19     * Returns a list of the employee's custom fields.
20     */
21    pub async fn get_employee(
22        &self,
23        employee_id: &str,
24    ) -> ClientResult<crate::Response<crate::types::GetEmployeeCustomFieldsResponse>> {
25        let url = self.client.url(
26            &format!(
27                "/v1/employees/{}/custom_fields",
28                crate::progenitor_support::encode_path(employee_id),
29            ),
30            None,
31        );
32        self.client
33            .get(
34                &url,
35                crate::Message {
36                    body: None,
37                    content_type: None,
38                },
39            )
40            .await
41    }
42    /**
43     * Get the custom fields of a company.
44     *
45     * This function performs a `GET` to the `/v1/companies/{company_id}/custom_fields` endpoint.
46     *
47     * Returns a list of the custom fields of the company. Useful when you need to know the schema of custom fields for an entire company
48     */
49    pub async fn get_company(
50        &self,
51        company_id: &str,
52    ) -> ClientResult<crate::Response<crate::types::GetCompanyCustomFieldsResponse>> {
53        let url = self.client.url(
54            &format!(
55                "/v1/companies/{}/custom_fields",
56                crate::progenitor_support::encode_path(company_id),
57            ),
58            None,
59        );
60        self.client
61            .get(
62                &url,
63                crate::Message {
64                    body: None,
65                    content_type: None,
66                },
67            )
68            .await
69    }
70}