|
| 1 | +package com.nylas.models |
| 2 | + |
| 3 | +import com.squareup.moshi.Json |
| 4 | + |
| 5 | +/** |
| 6 | + * Class representation of the query parameters for listing import events. |
| 7 | + */ |
| 8 | +data class ListImportEventQueryParams( |
| 9 | + /** |
| 10 | + * Filter for the specified calendar ID. |
| 11 | + * (Not supported for iCloud) You can use primary to query the end user's primary calendar. |
| 12 | + * This is a required parameter. |
| 13 | + */ |
| 14 | + @Json(name = "calendar_id") |
| 15 | + val calendarId: String, |
| 16 | + /** |
| 17 | + * The maximum number of objects to return. |
| 18 | + * This field defaults to 50. The maximum allowed value is 500. |
| 19 | + */ |
| 20 | + @Json(name = "limit") |
| 21 | + val limit: Int? = null, |
| 22 | + /** |
| 23 | + * An identifier that specifies which page of data to return. |
| 24 | + * This value should be taken from the [ListResponse.nextCursor] response field. |
| 25 | + */ |
| 26 | + @Json(name = "page_token") |
| 27 | + val pageToken: String? = null, |
| 28 | + /** |
| 29 | + * Filter for events that start at or after the specified time, in Unix timestamp format. |
| 30 | + * Defaults to the time that you make the request. |
| 31 | + */ |
| 32 | + @Json(name = "start") |
| 33 | + val start: Int? = null, |
| 34 | + /** |
| 35 | + * Filter for events that end at or before the specified time, in Unix timestamp format. |
| 36 | + * Defaults to one month from the time you make the request. |
| 37 | + */ |
| 38 | + @Json(name = "end") |
| 39 | + val end: Int? = null, |
| 40 | + /** |
| 41 | + * Specify fields that you want Nylas to return, as a comma-separated list. |
| 42 | + * This allows you to receive only the portion of object data that you're interested in. |
| 43 | + */ |
| 44 | + @Json(name = "select") |
| 45 | + val select: String? = null, |
| 46 | +) : IQueryParams { |
| 47 | + /** |
| 48 | + * Builder for [ListImportEventQueryParams]. |
| 49 | + */ |
| 50 | + data class Builder( |
| 51 | + /** |
| 52 | + * Filter for the specified calendar ID. |
| 53 | + * (Not supported for iCloud) You can use primary to query the end user's primary calendar. |
| 54 | + * This is a required parameter. |
| 55 | + */ |
| 56 | + private val calendarId: String, |
| 57 | + ) { |
| 58 | + private var limit: Int? = null |
| 59 | + private var pageToken: String? = null |
| 60 | + private var start: Int? = null |
| 61 | + private var end: Int? = null |
| 62 | + private var select: String? = null |
| 63 | + |
| 64 | + /** |
| 65 | + * Sets the maximum number of objects to return. |
| 66 | + * This field defaults to 50. The maximum allowed value is 500. |
| 67 | + * @param limit The maximum number of objects to return. |
| 68 | + * @return The builder. |
| 69 | + */ |
| 70 | + fun limit(limit: Int?) = apply { this.limit = limit } |
| 71 | + |
| 72 | + /** |
| 73 | + * Sets the identifier that specifies which page of data to return. |
| 74 | + * This value should be taken from the [ListResponse.nextCursor] response field. |
| 75 | + * @param pageToken The identifier that specifies which page of data to return. |
| 76 | + * @return The builder. |
| 77 | + */ |
| 78 | + fun pageToken(pageToken: String?) = apply { this.pageToken = pageToken } |
| 79 | + |
| 80 | + /** |
| 81 | + * Sets the start time to filter events by. |
| 82 | + * Filter for events that start at or after the specified time, in Unix timestamp format. |
| 83 | + * @param start The start time to filter events by. |
| 84 | + * @return The builder. |
| 85 | + */ |
| 86 | + fun start(start: Int?) = apply { this.start = start } |
| 87 | + |
| 88 | + /** |
| 89 | + * Sets the end time to filter events by. |
| 90 | + * Filter for events that end at or before the specified time, in Unix timestamp format. |
| 91 | + * @param end The end time to filter events by. |
| 92 | + * @return The builder. |
| 93 | + */ |
| 94 | + fun end(end: Int?) = apply { this.end = end } |
| 95 | + |
| 96 | + /** |
| 97 | + * Sets the fields to return in the response. |
| 98 | + * Specify fields that you want Nylas to return, as a comma-separated list. |
| 99 | + * @param select The fields to return in the response. |
| 100 | + * @return The builder. |
| 101 | + */ |
| 102 | + fun select(select: String?) = apply { this.select = select } |
| 103 | + |
| 104 | + /** |
| 105 | + * Builds a [ListImportEventQueryParams] instance. |
| 106 | + * @return The [ListImportEventQueryParams] instance. |
| 107 | + */ |
| 108 | + fun build() = ListImportEventQueryParams( |
| 109 | + calendarId, |
| 110 | + limit, |
| 111 | + pageToken, |
| 112 | + start, |
| 113 | + end, |
| 114 | + select, |
| 115 | + ) |
| 116 | + } |
| 117 | +} |
0 commit comments