Files
apiclient/model_api_key_response.go
zeekayandHanzo Dev 9cfc3af66d the Go client for Hanzo Runtime
Generated from Runtime's OpenAPI document, and pure standard library — it
requires nothing else, so a caller pays only for this package.

It lives here rather than inside Runtime because a nested module is resolved
by the path it declares, and one declaring a path it does not sit at is
reachable by nobody: no proxy answers for it and no consumer can name it.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-14 08:41:09 -07:00

278 lines
6.6 KiB
Go

/*
Runtime
Runtime AI platform API Docs
API version: 1.0
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package apiclient
import (
"bytes"
"encoding/json"
"fmt"
"time"
)
// checks if the ApiKeyResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ApiKeyResponse{}
// ApiKeyResponse struct for ApiKeyResponse
type ApiKeyResponse struct {
// The name of the API key
Name string `json:"name"`
// The API key value
Value string `json:"value"`
// When the API key was created
CreatedAt time.Time `json:"createdAt"`
// The list of organization resource permissions assigned to the API key
Permissions []string `json:"permissions"`
// When the API key expires
ExpiresAt NullableTime `json:"expiresAt"`
}
type _ApiKeyResponse ApiKeyResponse
// NewApiKeyResponse instantiates a new ApiKeyResponse object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewApiKeyResponse(name string, value string, createdAt time.Time, permissions []string, expiresAt NullableTime) *ApiKeyResponse {
this := ApiKeyResponse{}
this.Name = name
this.Value = value
this.CreatedAt = createdAt
this.Permissions = permissions
this.ExpiresAt = expiresAt
return &this
}
// NewApiKeyResponseWithDefaults instantiates a new ApiKeyResponse object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewApiKeyResponseWithDefaults() *ApiKeyResponse {
this := ApiKeyResponse{}
return &this
}
// GetName returns the Name field value
func (o *ApiKeyResponse) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *ApiKeyResponse) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *ApiKeyResponse) SetName(v string) {
o.Name = v
}
// GetValue returns the Value field value
func (o *ApiKeyResponse) GetValue() string {
if o == nil {
var ret string
return ret
}
return o.Value
}
// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *ApiKeyResponse) GetValueOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Value, true
}
// SetValue sets field value
func (o *ApiKeyResponse) SetValue(v string) {
o.Value = v
}
// GetCreatedAt returns the CreatedAt field value
func (o *ApiKeyResponse) GetCreatedAt() time.Time {
if o == nil {
var ret time.Time
return ret
}
return o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *ApiKeyResponse) GetCreatedAtOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return &o.CreatedAt, true
}
// SetCreatedAt sets field value
func (o *ApiKeyResponse) SetCreatedAt(v time.Time) {
o.CreatedAt = v
}
// GetPermissions returns the Permissions field value
func (o *ApiKeyResponse) GetPermissions() []string {
if o == nil {
var ret []string
return ret
}
return o.Permissions
}
// GetPermissionsOk returns a tuple with the Permissions field value
// and a boolean to check if the value has been set.
func (o *ApiKeyResponse) GetPermissionsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.Permissions, true
}
// SetPermissions sets field value
func (o *ApiKeyResponse) SetPermissions(v []string) {
o.Permissions = v
}
// GetExpiresAt returns the ExpiresAt field value
// If the value is explicit nil, the zero value for time.Time will be returned
func (o *ApiKeyResponse) GetExpiresAt() time.Time {
if o == nil || o.ExpiresAt.Get() == nil {
var ret time.Time
return ret
}
return *o.ExpiresAt.Get()
}
// GetExpiresAtOk returns a tuple with the ExpiresAt field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *ApiKeyResponse) GetExpiresAtOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return o.ExpiresAt.Get(), o.ExpiresAt.IsSet()
}
// SetExpiresAt sets field value
func (o *ApiKeyResponse) SetExpiresAt(v time.Time) {
o.ExpiresAt.Set(&v)
}
func (o ApiKeyResponse) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ApiKeyResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
toSerialize["value"] = o.Value
toSerialize["createdAt"] = o.CreatedAt
toSerialize["permissions"] = o.Permissions
toSerialize["expiresAt"] = o.ExpiresAt.Get()
return toSerialize, nil
}
func (o *ApiKeyResponse) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"name",
"value",
"createdAt",
"permissions",
"expiresAt",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varApiKeyResponse := _ApiKeyResponse{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varApiKeyResponse)
if err != nil {
return err
}
*o = ApiKeyResponse(varApiKeyResponse)
return err
}
type NullableApiKeyResponse struct {
value *ApiKeyResponse
isSet bool
}
func (v NullableApiKeyResponse) Get() *ApiKeyResponse {
return v.value
}
func (v *NullableApiKeyResponse) Set(val *ApiKeyResponse) {
v.value = val
v.isSet = true
}
func (v NullableApiKeyResponse) IsSet() bool {
return v.isSet
}
func (v *NullableApiKeyResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableApiKeyResponse(val *ApiKeyResponse) *NullableApiKeyResponse {
return &NullableApiKeyResponse{value: val, isSet: true}
}
func (v NullableApiKeyResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableApiKeyResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}