Skip to content

Latest commit

 

History

History
351 lines (269 loc) · 19.9 KB

File metadata and controls

351 lines (269 loc) · 19.9 KB

Functionalities

(Functionalities)

Overview

Operations related to Functionalities

Available Operations

  • List - List functionalities
  • Create - Create a functionality
  • Get - Get a functionality
  • Delete - Archive a functionality
  • Update - Update a functionality
  • ListServices - List services for a functionality

List

List all of the functionalities that have been added to the organiation

Example Usage

package main

import(
	"firehydrant"
	"context"
	"firehydrant/models/operations"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Functionalities.List(ctx, operations.ListFunctionalitiesRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.FunctionalityEntityPaginated != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ListFunctionalitiesResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

Create

Creates a functionality for the organization

Example Usage

package main

import(
	"firehydrant"
	"context"
	"firehydrant/models/components"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Functionalities.Create(ctx, components.PostV1Functionalities{
        Name: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.FunctionalityEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateFunctionalityResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

Get

Retrieves a single functionality by ID

Example Usage

package main

import(
	"firehydrant"
	"context"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Functionalities.Get(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.FunctionalityEntity != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
functionalityID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.GetFunctionalityResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

Delete

Archive a functionality

Example Usage

package main

import(
	"firehydrant"
	"context"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Functionalities.Delete(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.FunctionalityEntity != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
functionalityID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.DeleteFunctionalityResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

Update

Update a functionalities attributes

Example Usage

package main

import(
	"firehydrant"
	"context"
	"firehydrant/models/components"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Functionalities.Update(ctx, "<id>", components.PatchV1FunctionalitiesFunctionalityID{})
    if err != nil {
        log.Fatal(err)
    }
    if res.FunctionalityEntity != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
functionalityID string ✔️ N/A
patchV1FunctionalitiesFunctionalityID components.PatchV1FunctionalitiesFunctionalityID ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.UpdateFunctionalityResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

ListServices

List services for a functionality

Example Usage

package main

import(
	"firehydrant"
	"context"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Functionalities.ListServices(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
functionalityID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.GetFunctionalityServicesResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*