# TokensApi

All URIs are relative to *<https://api.ionos.com/containerregistries>*

| Method                                                    | HTTP request                                         | Description                                |
| --------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------ |
| [**RegistriesTokensDelete**](#RegistriesTokensDelete)     | **Delete** /registries/{registryId}/tokens/{tokenId} | Delete token                               |
| [**RegistriesTokensFindById**](#RegistriesTokensFindById) | **Get** /registries/{registryId}/tokens/{tokenId}    | Get token information                      |
| [**RegistriesTokensGet**](#RegistriesTokensGet)           | **Get** /registries/{registryId}/tokens              | List all tokens for the container registry |
| [**RegistriesTokensPatch**](#RegistriesTokensPatch)       | **Patch** /registries/{registryId}/tokens/{tokenId}  | Update token                               |
| [**RegistriesTokensPost**](#RegistriesTokensPost)         | **Post** /registries/{registryId}/tokens             | Create token                               |
| [**RegistriesTokensPut**](#RegistriesTokensPut)           | **Put** /registries/{registryId}/tokens/{tokenId}    | Create or replace token                    |

## RegistriesTokensDelete

```go
var result  = RegistriesTokensDelete(ctx, registryId, tokenId)
                      .Execute()
```

Delete token

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"
)

func main() {
    registryId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the registry
    tokenId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the token

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resp, err := apiClient.TokensApi.RegistriesTokensDelete(context.Background(), registryId, tokenId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `TokensApi.RegistriesTokensDelete``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
}
```

### Path Parameters

| Name           | Type                | Description                                                                 | Notes |
| -------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**        | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **registryId** | **string**          | The unique ID of the registry                                               |       |
| **tokenId**    | **string**          | The unique ID of the token                                                  |       |

### Other Parameters

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

### Return type

(empty response body)

### HTTP request headers

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

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"TokensApiService.RegistriesTokensDelete"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "TokensApiService.RegistriesTokensDelete": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "TokensApiService.RegistriesTokensDelete": {
    "port": "8443",
},
})
```

## RegistriesTokensFindById

```go
var result TokenResponse = RegistriesTokensFindById(ctx, registryId, tokenId)
                      .Execute()
```

Get token information

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"
)

func main() {
    registryId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the registry
    tokenId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the token

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.TokensApi.RegistriesTokensFindById(context.Background(), registryId, tokenId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `TokensApi.RegistriesTokensFindById``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `RegistriesTokensFindById`: TokenResponse
    fmt.Fprintf(os.Stdout, "Response from `TokensApi.RegistriesTokensFindById`: %v\n", resource)
}
```

### Path Parameters

| Name           | Type                | Description                                                                 | Notes |
| -------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**        | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **registryId** | **string**          | The unique ID of the registry                                               |       |
| **tokenId**    | **string**          | The unique ID of the token                                                  |       |

### Other Parameters

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

### Return type

[**TokenResponse**](/container-registry-sdk-golang/models/tokenresponse.md)

### HTTP request headers

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

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"TokensApiService.RegistriesTokensFindById"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "TokensApiService.RegistriesTokensFindById": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "TokensApiService.RegistriesTokensFindById": {
    "port": "8443",
},
})
```

## RegistriesTokensGet

```go
var result TokensResponse = RegistriesTokensGet(ctx, registryId)
                      .Offset(offset)
                      .Limit(limit)
                      .Execute()
```

List all tokens for the container registry

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"
)

func main() {
    registryId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the registry
    offset := "offset_example" // string | The first element (from the complete list of the elements) to include in the response (used together with limit for pagination) (optional) (default to "0")
    limit := "limit_example" // string | The maximum number of elements to return (used together with offset for pagination) (optional) (default to "100")

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.TokensApi.RegistriesTokensGet(context.Background(), registryId).Offset(offset).Limit(limit).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `TokensApi.RegistriesTokensGet``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `RegistriesTokensGet`: TokensResponse
    fmt.Fprintf(os.Stdout, "Response from `TokensApi.RegistriesTokensGet`: %v\n", resource)
}
```

### Path Parameters

| Name           | Type                | Description                                                                 | Notes |
| -------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**        | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **registryId** | **string**          | The unique ID of the registry                                               |       |

### Other Parameters

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

| Name       | Type       | Description                                                                                                                     | Notes               |
| ---------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| **offset** | **string** | The first element (from the complete list of the elements) to include in the response (used together with limit for pagination) | \[default to "0"]   |
| **limit**  | **string** | The maximum number of elements to return (used together with offset for pagination)                                             | \[default to "100"] |

### Return type

[**TokensResponse**](/container-registry-sdk-golang/models/tokensresponse.md)

### HTTP request headers

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

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"TokensApiService.RegistriesTokensGet"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "TokensApiService.RegistriesTokensGet": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "TokensApiService.RegistriesTokensGet": {
    "port": "8443",
},
})
```

## RegistriesTokensPatch

```go
var result TokenResponse = RegistriesTokensPatch(ctx, registryId, tokenId)
                      .PatchTokenInput(patchTokenInput)
                      .Execute()
```

Update token

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"
)

func main() {
    registryId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the registry
    tokenId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the token
    patchTokenInput := *openapiclient.NewPatchTokenInput() // PatchTokenInput | 

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.TokensApi.RegistriesTokensPatch(context.Background(), registryId, tokenId).PatchTokenInput(patchTokenInput).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `TokensApi.RegistriesTokensPatch``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `RegistriesTokensPatch`: TokenResponse
    fmt.Fprintf(os.Stdout, "Response from `TokensApi.RegistriesTokensPatch`: %v\n", resource)
}
```

### Path Parameters

| Name           | Type                | Description                                                                 | Notes |
| -------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**        | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **registryId** | **string**          | The unique ID of the registry                                               |       |
| **tokenId**    | **string**          | The unique ID of the token                                                  |       |

### Other Parameters

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

| Name                | Type                                                                            | Description | Notes |
| ------------------- | ------------------------------------------------------------------------------- | ----------- | ----- |
| **patchTokenInput** | [**PatchTokenInput**](/container-registry-sdk-golang/models/patchtokeninput.md) |             |       |

### Return type

[**TokenResponse**](/container-registry-sdk-golang/models/tokenresponse.md)

### HTTP request headers

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

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"TokensApiService.RegistriesTokensPatch"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "TokensApiService.RegistriesTokensPatch": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "TokensApiService.RegistriesTokensPatch": {
    "port": "8443",
},
})
```

## RegistriesTokensPost

```go
var result PostTokenOutput = RegistriesTokensPost(ctx, registryId)
                      .PostTokenInput(postTokenInput)
                      .Execute()
```

Create token

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"
)

func main() {
    registryId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the registry
    postTokenInput := *openapiclient.NewPostTokenInput(*openapiclient.NewPostTokenProperties("push-token")) // PostTokenInput | 

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.TokensApi.RegistriesTokensPost(context.Background(), registryId).PostTokenInput(postTokenInput).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `TokensApi.RegistriesTokensPost``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `RegistriesTokensPost`: PostTokenOutput
    fmt.Fprintf(os.Stdout, "Response from `TokensApi.RegistriesTokensPost`: %v\n", resource)
}
```

### Path Parameters

| Name           | Type                | Description                                                                 | Notes |
| -------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**        | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **registryId** | **string**          | The unique ID of the registry                                               |       |

### Other Parameters

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

| Name               | Type                                                                          | Description | Notes |
| ------------------ | ----------------------------------------------------------------------------- | ----------- | ----- |
| **postTokenInput** | [**PostTokenInput**](/container-registry-sdk-golang/models/posttokeninput.md) |             |       |

### Return type

[**PostTokenOutput**](/container-registry-sdk-golang/models/posttokenoutput.md)

### HTTP request headers

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

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"TokensApiService.RegistriesTokensPost"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "TokensApiService.RegistriesTokensPost": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "TokensApiService.RegistriesTokensPost": {
    "port": "8443",
},
})
```

## RegistriesTokensPut

```go
var result PutTokenOutput = RegistriesTokensPut(ctx, registryId, tokenId)
                      .PutTokenInput(putTokenInput)
                      .Execute()
```

Create or replace token

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"
)

func main() {
    registryId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The unique ID of the registry
    tokenId := "tokenId_example" // string | The unique ID of the token
    putTokenInput := *openapiclient.NewPutTokenInput(*openapiclient.NewPostTokenProperties("push-token")) // PutTokenInput | 

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.TokensApi.RegistriesTokensPut(context.Background(), registryId, tokenId).PutTokenInput(putTokenInput).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `TokensApi.RegistriesTokensPut``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `RegistriesTokensPut`: PutTokenOutput
    fmt.Fprintf(os.Stdout, "Response from `TokensApi.RegistriesTokensPut`: %v\n", resource)
}
```

### Path Parameters

| Name           | Type                | Description                                                                 | Notes |
| -------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**        | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **registryId** | **string**          | The unique ID of the registry                                               |       |
| **tokenId**    | **string**          | The unique ID of the token                                                  |       |

### Other Parameters

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

| Name              | Type                                                                        | Description | Notes |
| ----------------- | --------------------------------------------------------------------------- | ----------- | ----- |
| **putTokenInput** | [**PutTokenInput**](/container-registry-sdk-golang/models/puttokeninput.md) |             |       |

### Return type

[**PutTokenOutput**](/container-registry-sdk-golang/models/puttokenoutput.md)

### HTTP request headers

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

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"TokensApiService.RegistriesTokensPut"` string. Similar rules for overriding default operation server index and variables apply by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "TokensApiService.RegistriesTokensPut": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "TokensApiService.RegistriesTokensPut": {
    "port": "8443",
},
})
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/container-registry-sdk-golang/api/tokensapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
