Skip to content

Commit aa52dc7

Browse files
authored
Use alias types in connectors API where it makes sense (#2507)
1 parent dd2e9cb commit aa52dc7

File tree

5 files changed

+28
-25
lines changed

5 files changed

+28
-25
lines changed

specification/connector/_types/Connector.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { Id, ScalarValue } from '@_types/common'
19+
import { Field, Id, IndexName, ScalarValue } from '@_types/common'
2020
import { double, integer, long } from '@_types/Numeric'
21+
import { DateTime } from '@_types/Time'
2122
import { Dictionary } from '@spec_utils/Dictionary'
2223
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2324

@@ -120,7 +121,7 @@ interface CustomScheduling {
120121
configuration_overrides: CustomSchedulingConfigurationOverrides
121122
enabled: boolean
122123
interval: string
123-
last_synced?: string
124+
last_synced?: DateTime
124125
name: string
125126
}
126127

@@ -167,18 +168,18 @@ enum FilteringRuleRule {
167168
}
168169

169170
interface FilteringRule {
170-
created_at: string
171-
field: string
172-
id: string
171+
created_at: DateTime
172+
field: Field
173+
id: Id
173174
order: integer
174175
policy: FilteringPolicy
175176
rule: FilteringRuleRule
176-
updated_at: string
177+
updated_at: DateTime
177178
value: string
178179
}
179180

180181
interface FilteringValidation {
181-
ids: string[]
182+
ids: Id[]
182183
messages: string[]
183184
}
184185

@@ -189,8 +190,8 @@ enum FilteringValidationState {
189190
}
190191

191192
interface FilteringAdvancedSnippet {
192-
created_at: string
193-
updated_at: string
193+
created_at: DateTime
194+
updated_at: DateTime
194195
value: Dictionary<string, UserDefinedValue>
195196
}
196197

@@ -243,20 +244,20 @@ export interface Connector {
243244
features: ConnectorFeatures
244245
filtering: FilteringConfig[]
245246
id?: Id
246-
index_name?: string
247+
index_name?: IndexName
247248
is_native: boolean
248249
language?: string
249250
last_access_control_sync_error?: string
250-
last_access_control_sync_scheduled_at?: string
251+
last_access_control_sync_scheduled_at?: DateTime
251252
last_access_control_sync_status?: SyncStatus
252253
last_deleted_document_count?: long
253-
last_incremental_sync_scheduled_at?: string
254+
last_incremental_sync_scheduled_at?: DateTime
254255
last_indexed_document_count?: long
255-
last_seen?: string
256+
last_seen?: DateTime
256257
last_sync_error?: string
257-
last_sync_scheduled_at?: string
258+
last_sync_scheduled_at?: DateTime
258259
last_sync_status?: SyncStatus
259-
last_synced?: string
260+
last_synced?: DateTime
260261
name?: string
261262
pipeline?: IngestPipelineParams
262263
scheduling: SchedulingConfiguration

specification/connector/last_sync/ConnectorUpdateLastSyncRequest.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Id } from '@_types/common'
2121
import { SyncStatus } from '../_types/Connector'
2222
import { long } from '@_types/Numeric'
2323
import { WithNullValue } from '@spec_utils/utils'
24+
import { DateTime } from '@_types/Time'
2425

2526
/**
2627
* Updates last sync stats in the connector document
@@ -41,15 +42,15 @@ export interface Request extends RequestBase {
4142
*/
4243
body: {
4344
last_access_control_sync_error?: WithNullValue<string>
44-
last_access_control_sync_scheduled_at?: string
45+
last_access_control_sync_scheduled_at?: DateTime
4546
last_access_control_sync_status?: SyncStatus
4647
last_deleted_document_count?: long
47-
last_incremental_sync_scheduled_at?: string
48+
last_incremental_sync_scheduled_at?: DateTime
4849
last_indexed_document_count?: long
49-
last_seen?: WithNullValue<string>
50+
last_seen?: WithNullValue<DateTime>
5051
last_sync_error?: WithNullValue<string>
51-
last_sync_scheduled_at?: string
52+
last_sync_scheduled_at?: DateTime
5253
last_sync_status?: SyncStatus
53-
last_synced?: string
54+
last_synced?: DateTime
5455
}
5556
}

specification/connector/post/ConnectorPostRequest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919
import { RequestBase } from '@_types/Base'
20+
import { IndexName } from '@_types/common'
2021
import { WithNullValue } from '@spec_utils/utils'
2122

2223
/**
@@ -33,7 +34,7 @@ export interface Request extends RequestBase {
3334
/** @codegen_name connector */
3435
body: {
3536
description?: string
36-
index_name: WithNullValue<string>
37+
index_name: WithNullValue<IndexName>
3738
is_native?: boolean
3839
language?: string
3940
name?: string

specification/connector/put/ConnectorPutRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919
import { RequestBase } from '@_types/Base'
20-
import { Id } from '@_types/common'
20+
import { Id, IndexName } from '@_types/common'
2121
import { WithNullValue } from '@spec_utils/utils'
2222

2323
/**
@@ -40,7 +40,7 @@ export interface Request extends RequestBase {
4040
/** @codegen_name connector */
4141
body: {
4242
description?: string
43-
index_name: WithNullValue<string>
43+
index_name: WithNullValue<IndexName>
4444
is_native?: boolean
4545
language?: string
4646
name?: string

specification/connector/update_index_name/ConnectorUpdateIndexNameRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919
import { RequestBase } from '@_types/Base'
20-
import { Id } from '@_types/common'
20+
import { Id, IndexName } from '@_types/common'
2121
import { WithNullValue } from '@spec_utils/utils'
2222

2323
/**
@@ -38,6 +38,6 @@ export interface Request extends RequestBase {
3838
* The connector index name
3939
*/
4040
body: {
41-
index_name: WithNullValue<string>
41+
index_name: WithNullValue<IndexName>
4242
}
4343
}

0 commit comments

Comments
 (0)