Skip to content

Latest commit

 

History

History
506 lines (430 loc) · 27.5 KB

README.md

File metadata and controls

506 lines (430 loc) · 27.5 KB

TimeOffRequests

(Hris.TimeOffRequests)

Overview

Available Operations

  • List - List Time Off Requests
  • Create - Create Time Off Request
  • Get - Get Time Off Request
  • Update - Update Time Off Request
  • Delete - Delete Time Off Request

List

List Time Off Requests

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/components"
	"github.com/apideck-libraries/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Hris.TimeOffRequests.List(ctx, operations.HrisTimeOffRequestsAllRequest{
        ServiceID: sdkgo.String("salesforce"),
        Filter: &components.TimeOffRequestsFilter{
            StartDate: sdkgo.String("2022-04-08"),
            EndDate: sdkgo.String("2022-04-21"),
            UpdatedSince: sdkgo.String("2020-09-30T07:43:32.000Z"),
            EmployeeID: sdkgo.String("1234"),
            TimeOffRequestStatus: components.TimeOffRequestStatusApproved.ToPointer(),
            CompanyID: sdkgo.String("1234"),
        },
        PassThrough: map[string]any{
            "search": "San Francisco",
        },
        Fields: sdkgo.String("id,updated_at"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetTimeOffRequestsResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.HrisTimeOffRequestsAllRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.HrisTimeOffRequestsAllResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*

Create

Create Time Off Request

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/components"
	"github.com/apideck-libraries/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Hris.TimeOffRequests.Create(ctx, operations.HrisTimeOffRequestsAddRequest{
        ServiceID: sdkgo.String("salesforce"),
        TimeOffRequest: components.TimeOffRequestInput{
            EmployeeID: sdkgo.String("12345"),
            PolicyID: sdkgo.String("12345"),
            Status: components.TimeOffRequestStatusStatusApproved.ToPointer(),
            Description: sdkgo.String("Enjoying some sun."),
            StartDate: sdkgo.String("2022-04-01"),
            EndDate: sdkgo.String("2022-04-01"),
            RequestDate: sdkgo.String("2022-03-21"),
            RequestType: components.RequestTypeVacation.ToPointer(),
            ApprovalDate: sdkgo.String("2022-03-21"),
            Units: components.UnitsHours.ToPointer(),
            Amount: sdkgo.Float64(3.5),
            DayPart: sdkgo.String("morning"),
            Notes: &components.Notes{
                Employee: sdkgo.String("Relaxing on the beach for a few hours."),
                Manager: sdkgo.String("Enjoy!"),
            },
            PassThrough: []components.PassThroughBody{
                components.PassThroughBody{
                    ServiceID: "<id>",
                    ExtendPaths: []components.ExtendPaths{
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                    },
                },
                components.PassThroughBody{
                    ServiceID: "<id>",
                    ExtendPaths: []components.ExtendPaths{
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                    },
                },
            },
            PolicyType: sdkgo.String("sick"),
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.CreateTimeOffRequestResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.HrisTimeOffRequestsAddRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.HrisTimeOffRequestsAddResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*

Get

Get Time Off Request

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Hris.TimeOffRequests.Get(ctx, operations.HrisTimeOffRequestsOneRequest{
        ID: "<id>",
        ServiceID: sdkgo.String("salesforce"),
        Fields: sdkgo.String("id,updated_at"),
        EmployeeID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetTimeOffRequestResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.HrisTimeOffRequestsOneRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.HrisTimeOffRequestsOneResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*

Update

Update Time Off Request

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/components"
	"github.com/apideck-libraries/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Hris.TimeOffRequests.Update(ctx, operations.HrisTimeOffRequestsUpdateRequest{
        ID: "<id>",
        ServiceID: sdkgo.String("salesforce"),
        EmployeeID: "<id>",
        TimeOffRequest: components.TimeOffRequestInput{
            EmployeeID: sdkgo.String("12345"),
            PolicyID: sdkgo.String("12345"),
            Status: components.TimeOffRequestStatusStatusApproved.ToPointer(),
            Description: sdkgo.String("Enjoying some sun."),
            StartDate: sdkgo.String("2022-04-01"),
            EndDate: sdkgo.String("2022-04-01"),
            RequestDate: sdkgo.String("2022-03-21"),
            RequestType: components.RequestTypeVacation.ToPointer(),
            ApprovalDate: sdkgo.String("2022-03-21"),
            Units: components.UnitsHours.ToPointer(),
            Amount: sdkgo.Float64(3.5),
            DayPart: sdkgo.String("morning"),
            Notes: &components.Notes{
                Employee: sdkgo.String("Relaxing on the beach for a few hours."),
                Manager: sdkgo.String("Enjoy!"),
            },
            PassThrough: []components.PassThroughBody{
                components.PassThroughBody{
                    ServiceID: "<id>",
                    ExtendPaths: []components.ExtendPaths{
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                    },
                },
                components.PassThroughBody{
                    ServiceID: "<id>",
                    ExtendPaths: []components.ExtendPaths{
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                    },
                },
                components.PassThroughBody{
                    ServiceID: "<id>",
                    ExtendPaths: []components.ExtendPaths{
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                        components.ExtendPaths{
                            Path: "$.nested.property",
                            Value: map[string]any{
                                "TaxClassificationRef": map[string]any{
                                    "value": "EUC-99990201-V1-00020000",
                                },
                            },
                        },
                    },
                },
            },
            PolicyType: sdkgo.String("sick"),
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.UpdateTimeOffRequestResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.HrisTimeOffRequestsUpdateRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.HrisTimeOffRequestsUpdateResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*

Delete

Delete Time Off Request

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Hris.TimeOffRequests.Delete(ctx, operations.HrisTimeOffRequestsDeleteRequest{
        ID: "<id>",
        ServiceID: sdkgo.String("salesforce"),
        EmployeeID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.DeleteTimeOffRequestResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.HrisTimeOffRequestsDeleteRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.HrisTimeOffRequestsDeleteResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*