ory-am/hydra

View on GitHub
internal/httpclient/model_pagination.go

Summary

Maintainability
D
2 days
Test Coverage
/*
Ory Hydra API

Documentation for all of Ory Hydra's APIs.

API version:
Contact: hi@ory.sh
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package openapi

import (
    "encoding/json"
)

// checks if the Pagination type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Pagination{}

// Pagination struct for Pagination
type Pagination struct {
    // Items per page  This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
    PageSize *int64 `json:"page_size,omitempty"`
    // Next Page Token  The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
    PageToken *string `json:"page_token,omitempty"`
}

// NewPagination instantiates a new Pagination 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 NewPagination() *Pagination {
    this := Pagination{}
    var pageSize int64 = 250
    this.PageSize = &pageSize
    var pageToken string = "1"
    this.PageToken = &pageToken
    return &this
}

// NewPaginationWithDefaults instantiates a new Pagination 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 NewPaginationWithDefaults() *Pagination {
    this := Pagination{}
    var pageSize int64 = 250
    this.PageSize = &pageSize
    var pageToken string = "1"
    this.PageToken = &pageToken
    return &this
}

// GetPageSize returns the PageSize field value if set, zero value otherwise.
func (o *Pagination) GetPageSize() int64 {
    if o == nil || IsNil(o.PageSize) {
        var ret int64
        return ret
    }
    return *o.PageSize
}

// GetPageSizeOk returns a tuple with the PageSize field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Pagination) GetPageSizeOk() (*int64, bool) {
    if o == nil || IsNil(o.PageSize) {
        return nil, false
    }
    return o.PageSize, true
}

// HasPageSize returns a boolean if a field has been set.
func (o *Pagination) HasPageSize() bool {
    if o != nil && !IsNil(o.PageSize) {
        return true
    }

    return false
}

// SetPageSize gets a reference to the given int64 and assigns it to the PageSize field.
func (o *Pagination) SetPageSize(v int64) {
    o.PageSize = &v
}

// GetPageToken returns the PageToken field value if set, zero value otherwise.
func (o *Pagination) GetPageToken() string {
    if o == nil || IsNil(o.PageToken) {
        var ret string
        return ret
    }
    return *o.PageToken
}

// GetPageTokenOk returns a tuple with the PageToken field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Pagination) GetPageTokenOk() (*string, bool) {
    if o == nil || IsNil(o.PageToken) {
        return nil, false
    }
    return o.PageToken, true
}

// HasPageToken returns a boolean if a field has been set.
func (o *Pagination) HasPageToken() bool {
    if o != nil && !IsNil(o.PageToken) {
        return true
    }

    return false
}

// SetPageToken gets a reference to the given string and assigns it to the PageToken field.
func (o *Pagination) SetPageToken(v string) {
    o.PageToken = &v
}

func (o Pagination) MarshalJSON() ([]byte, error) {
    toSerialize, err := o.ToMap()
    if err != nil {
        return []byte{}, err
    }
    return json.Marshal(toSerialize)
}

func (o Pagination) ToMap() (map[string]interface{}, error) {
    toSerialize := map[string]interface{}{}
    if !IsNil(o.PageSize) {
        toSerialize["page_size"] = o.PageSize
    }
    if !IsNil(o.PageToken) {
        toSerialize["page_token"] = o.PageToken
    }
    return toSerialize, nil
}

type NullablePagination struct {
    value *Pagination
    isSet bool
}

func (v NullablePagination) Get() *Pagination {
    return v.value
}

func (v *NullablePagination) Set(val *Pagination) {
    v.value = val
    v.isSet = true
}

func (v NullablePagination) IsSet() bool {
    return v.isSet
}

func (v *NullablePagination) Unset() {
    v.value = nil
    v.isSet = false
}

func NewNullablePagination(val *Pagination) *NullablePagination {
    return &NullablePagination{value: val, isSet: true}
}

func (v NullablePagination) MarshalJSON() ([]byte, error) {
    return json.Marshal(v.value)
}

func (v *NullablePagination) UnmarshalJSON(src []byte) error {
    v.isSet = true
    return json.Unmarshal(src, &v.value)
}