Skip to content

Latest commit

 

History

History
368 lines (241 loc) · 11.4 KB

EnvironmentsApi.md

File metadata and controls

368 lines (241 loc) · 11.4 KB

\EnvironmentsApi

All URIs are relative to https://api.gitbook.com/v1

Method HTTP request Description
CreateEnvironment Post /orgs/{organizationId}/environments Create a new environment within an organization
DeleteEnvironment Delete /orgs/{organizationId}/environments/{environmentName} Delete an environment in an organization
GetEnvironmentByName Get /orgs/{organizationId}/environments/{environmentName} Get an environment by its name
ListEnvironments Get /orgs/{organizationId}/environments Get the environments in an organization
UpdateEnvironment Patch /orgs/{organizationId}/environments/{environmentName} Update an existing environment within an organization

CreateEnvironment

Environment CreateEnvironment(ctx, organizationId).CreateEnvironment(createEnvironment).Execute()

Create a new environment within an organization

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/GitbookIO/go-gitbook"
)

func main() {
    organizationId := "organizationId_example" // string | The unique id of the organization
    createEnvironment := *openapiclient.NewCreateEnvironment("Name_example", "Title_example") // CreateEnvironment | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.EnvironmentsApi.CreateEnvironment(context.Background(), organizationId).CreateEnvironment(createEnvironment).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `EnvironmentsApi.CreateEnvironment``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateEnvironment`: Environment
    fmt.Fprintf(os.Stdout, "Response from `EnvironmentsApi.CreateEnvironment`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
organizationId string The unique id of the organization

Other Parameters

Other parameters are passed through a pointer to a apiCreateEnvironmentRequest struct via the builder pattern

Name Type Description Notes

createEnvironment | CreateEnvironment | |

Return type

Environment

Authorization

user

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteEnvironment

DeleteEnvironment(ctx, organizationId, environmentName).Execute()

Delete an environment in an organization

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/GitbookIO/go-gitbook"
)

func main() {
    organizationId := "organizationId_example" // string | The unique id of the organization
    environmentName := "environmentName_example" // string | The unique name of the environment within the organization

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    r, err := apiClient.EnvironmentsApi.DeleteEnvironment(context.Background(), organizationId, environmentName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `EnvironmentsApi.DeleteEnvironment``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
organizationId string The unique id of the organization
environmentName string The unique name of the environment within the organization

Other Parameters

Other parameters are passed through a pointer to a apiDeleteEnvironmentRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

user

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetEnvironmentByName

Environment GetEnvironmentByName(ctx, organizationId, environmentName).Execute()

Get an environment by its name

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/GitbookIO/go-gitbook"
)

func main() {
    organizationId := "organizationId_example" // string | The unique id of the organization
    environmentName := "environmentName_example" // string | The unique name of the environment within the organization

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.EnvironmentsApi.GetEnvironmentByName(context.Background(), organizationId, environmentName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `EnvironmentsApi.GetEnvironmentByName``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetEnvironmentByName`: Environment
    fmt.Fprintf(os.Stdout, "Response from `EnvironmentsApi.GetEnvironmentByName`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
organizationId string The unique id of the organization
environmentName string The unique name of the environment within the organization

Other Parameters

Other parameters are passed through a pointer to a apiGetEnvironmentByNameRequest struct via the builder pattern

Name Type Description Notes

Return type

Environment

Authorization

user

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListEnvironments

ListEnvironments200Response ListEnvironments(ctx, organizationId).Page(page).Limit(limit).Execute()

Get the environments in an organization

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/GitbookIO/go-gitbook"
)

func main() {
    organizationId := "organizationId_example" // string | The unique id of the organization
    page := "page_example" // string | Identifier of the page results to fetch. (optional)
    limit := float32(8.14) // float32 | The number of results per page (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.EnvironmentsApi.ListEnvironments(context.Background(), organizationId).Page(page).Limit(limit).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `EnvironmentsApi.ListEnvironments``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListEnvironments`: ListEnvironments200Response
    fmt.Fprintf(os.Stdout, "Response from `EnvironmentsApi.ListEnvironments`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
organizationId string The unique id of the organization

Other Parameters

Other parameters are passed through a pointer to a apiListEnvironmentsRequest struct via the builder pattern

Name Type Description Notes

page | string | Identifier of the page results to fetch. | limit | float32 | The number of results per page |

Return type

ListEnvironments200Response

Authorization

user

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateEnvironment

Environment UpdateEnvironment(ctx, organizationId, environmentName).UpdateEnvironment(updateEnvironment).Execute()

Update an existing environment within an organization

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/GitbookIO/go-gitbook"
)

func main() {
    organizationId := "organizationId_example" // string | The unique id of the organization
    environmentName := "environmentName_example" // string | The unique name of the environment within the organization
    updateEnvironment := *openapiclient.NewUpdateEnvironment() // UpdateEnvironment | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.EnvironmentsApi.UpdateEnvironment(context.Background(), organizationId, environmentName).UpdateEnvironment(updateEnvironment).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `EnvironmentsApi.UpdateEnvironment``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateEnvironment`: Environment
    fmt.Fprintf(os.Stdout, "Response from `EnvironmentsApi.UpdateEnvironment`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
organizationId string The unique id of the organization
environmentName string The unique name of the environment within the organization

Other Parameters

Other parameters are passed through a pointer to a apiUpdateEnvironmentRequest struct via the builder pattern

Name Type Description Notes

updateEnvironment | UpdateEnvironment | |

Return type

Environment

Authorization

user

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]