Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Aug 24, 2024
1 parent da276d4 commit 5d56754
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 1,184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ constructor(
private val type: Type?,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
private val additionalBodyProperties: Map<String, JsonValue>,
) {

fun projectVersionId(): String = projectVersionId
Expand Down Expand Up @@ -63,8 +62,6 @@ constructor(

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
Expand All @@ -78,8 +75,7 @@ constructor(
this.status == other.status &&
this.type == other.type &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders &&
this.additionalBodyProperties == other.additionalBodyProperties
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
Expand All @@ -92,12 +88,11 @@ constructor(
type,
additionalQueryParams,
additionalHeaders,
additionalBodyProperties,
)
}

override fun toString() =
"CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
"CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

Expand All @@ -117,7 +112,6 @@ constructor(
private var type: Type? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(commitTestResultListParams: CommitTestResultListParams) = apply {
Expand All @@ -129,7 +123,6 @@ constructor(
this.type = commitTestResultListParams.type
additionalQueryParams(commitTestResultListParams.additionalQueryParams)
additionalHeaders(commitTestResultListParams.additionalHeaders)
additionalBodyProperties(commitTestResultListParams.additionalBodyProperties)
}

fun projectVersionId(projectVersionId: String) = apply {
Expand Down Expand Up @@ -199,20 +192,6 @@ constructor(

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
this.additionalBodyProperties.put(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun build(): CommitTestResultListParams =
CommitTestResultListParams(
checkNotNull(projectVersionId) { "`projectVersionId` is required but was not set" },
Expand All @@ -223,7 +202,6 @@ constructor(
type,
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import java.util.Optional
@NoAutoDetect
class CommitTestResultListResponse
private constructor(
private val _meta: JsonField<_Meta>,
private val items: JsonField<List<Item>>,
private val additionalProperties: Map<String, JsonValue>,
) {
Expand All @@ -41,12 +40,8 @@ private constructor(

private var hashCode: Int = 0

fun _meta(): _Meta = _meta.getRequired("_meta")

fun items(): List<Item> = items.getRequired("items")

@JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta

@JsonProperty("items") @ExcludeMissing fun _items() = items

@JsonAnyGetter
Expand All @@ -55,7 +50,6 @@ private constructor(

fun validate(): CommitTestResultListResponse = apply {
if (!validated) {
_meta().validate()
items().forEach { it.validate() }
validated = true
}
Expand All @@ -69,25 +63,19 @@ private constructor(
}

return other is CommitTestResultListResponse &&
this._meta == other._meta &&
this.items == other.items &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
_meta,
items,
additionalProperties,
)
hashCode = Objects.hash(items, additionalProperties)
}
return hashCode
}

override fun toString() =
"CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}"
"CommitTestResultListResponse{items=$items, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -96,23 +84,15 @@ private constructor(

class Builder {

private var _meta: JsonField<_Meta> = JsonMissing.of()
private var items: JsonField<List<Item>> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(commitTestResultListResponse: CommitTestResultListResponse) = apply {
this._meta = commitTestResultListResponse._meta
this.items = commitTestResultListResponse.items
additionalProperties(commitTestResultListResponse.additionalProperties)
}

fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta))

@JsonProperty("_meta")
@ExcludeMissing
fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta }

fun items(items: List<Item>) = items(JsonField.of(items))

@JsonProperty("items")
Expand All @@ -135,176 +115,11 @@ private constructor(

fun build(): CommitTestResultListResponse =
CommitTestResultListResponse(
_meta,
items.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
additionalProperties.toUnmodifiable()
)
}

@JsonDeserialize(builder = _Meta.Builder::class)
@NoAutoDetect
class _Meta
private constructor(
private val page: JsonField<Long>,
private val perPage: JsonField<Long>,
private val totalItems: JsonField<Long>,
private val totalPages: JsonField<Long>,
private val additionalProperties: Map<String, JsonValue>,
) {

private var validated: Boolean = false

private var hashCode: Int = 0

/** The current page. */
fun page(): Long = page.getRequired("page")

/** The number of items per page. */
fun perPage(): Long = perPage.getRequired("perPage")

/** The total number of items. */
fun totalItems(): Long = totalItems.getRequired("totalItems")

/** The total number of pages. */
fun totalPages(): Long = totalPages.getRequired("totalPages")

/** The current page. */
@JsonProperty("page") @ExcludeMissing fun _page() = page

/** The number of items per page. */
@JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage

/** The total number of items. */
@JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems

/** The total number of pages. */
@JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

fun validate(): _Meta = apply {
if (!validated) {
page()
perPage()
totalItems()
totalPages()
validated = true
}
}

fun toBuilder() = Builder().from(this)

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is _Meta &&
this.page == other.page &&
this.perPage == other.perPage &&
this.totalItems == other.totalItems &&
this.totalPages == other.totalPages &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
page,
perPage,
totalItems,
totalPages,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}"

companion object {

@JvmStatic fun builder() = Builder()
}

class Builder {

private var page: JsonField<Long> = JsonMissing.of()
private var perPage: JsonField<Long> = JsonMissing.of()
private var totalItems: JsonField<Long> = JsonMissing.of()
private var totalPages: JsonField<Long> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(_meta: _Meta) = apply {
this.page = _meta.page
this.perPage = _meta.perPage
this.totalItems = _meta.totalItems
this.totalPages = _meta.totalPages
additionalProperties(_meta.additionalProperties)
}

/** The current page. */
fun page(page: Long) = page(JsonField.of(page))

/** The current page. */
@JsonProperty("page")
@ExcludeMissing
fun page(page: JsonField<Long>) = apply { this.page = page }

/** The number of items per page. */
fun perPage(perPage: Long) = perPage(JsonField.of(perPage))

/** The number of items per page. */
@JsonProperty("perPage")
@ExcludeMissing
fun perPage(perPage: JsonField<Long>) = apply { this.perPage = perPage }

/** The total number of items. */
fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems))

/** The total number of items. */
@JsonProperty("totalItems")
@ExcludeMissing
fun totalItems(totalItems: JsonField<Long>) = apply { this.totalItems = totalItems }

/** The total number of pages. */
fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages))

/** The total number of pages. */
@JsonProperty("totalPages")
@ExcludeMissing
fun totalPages(totalPages: JsonField<Long>) = apply { this.totalPages = totalPages }

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}

fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}

fun build(): _Meta =
_Meta(
page,
perPage,
totalItems,
totalPages,
additionalProperties.toUnmodifiable(),
)
}
}

@JsonDeserialize(builder = Item.Builder::class)
@NoAutoDetect
class Item
Expand Down
Loading

0 comments on commit 5d56754

Please sign in to comment.