Skip to content

Commit 60e1c86

Browse files
Adding API Key functionality
1 parent 8a4d23f commit 60e1c86

File tree

17 files changed

+2448
-174
lines changed

17 files changed

+2448
-174
lines changed

packages/api/generated-schema-clean.gql

+204
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,81 @@ type AlternateLanguageLabelsForFormElementPayload {
180180
query: Query
181181
}
182182

183+
type ApiKey implements Node {
184+
createdAt: Datetime!
185+
createdBy: Int!
186+
expiresAt: Datetime
187+
id: UUID!
188+
isRevoked: Boolean!
189+
label: String!
190+
lastUsedAt: Datetime
191+
192+
"""
193+
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
194+
"""
195+
nodeId: ID!
196+
197+
"""Reads a single `Project` that is related to this `ApiKey`."""
198+
project: Project
199+
projectId: Int!
200+
201+
"""Reads a single `User` that is related to this `ApiKey`."""
202+
userByCreatedBy: User
203+
}
204+
205+
"""
206+
A condition to be used against `ApiKey` object types. All fields are tested for equality and combined with a logical ‘and.’
207+
"""
208+
input ApiKeyCondition {
209+
"""Checks for equality with the object’s `createdBy` field."""
210+
createdBy: Int
211+
212+
"""Checks for equality with the object’s `id` field."""
213+
id: UUID
214+
215+
"""Checks for equality with the object’s `projectId` field."""
216+
projectId: Int
217+
}
218+
219+
"""A connection to a list of `ApiKey` values."""
220+
type ApiKeysConnection {
221+
"""
222+
A list of edges which contains the `ApiKey` and cursor to aid in pagination.
223+
"""
224+
edges: [ApiKeysEdge!]!
225+
226+
"""A list of `ApiKey` objects."""
227+
nodes: [ApiKey!]!
228+
229+
"""Information to aid in pagination."""
230+
pageInfo: PageInfo!
231+
232+
"""The count of *all* `ApiKey` you could get from the connection."""
233+
totalCount: Int!
234+
}
235+
236+
"""A `ApiKey` edge in the connection."""
237+
type ApiKeysEdge {
238+
"""A cursor for use in pagination."""
239+
cursor: Cursor
240+
241+
"""The `ApiKey` at the end of the edge."""
242+
node: ApiKey!
243+
}
244+
245+
"""Methods to use when ordering `ApiKey`."""
246+
enum ApiKeysOrderBy {
247+
CREATED_BY_ASC
248+
CREATED_BY_DESC
249+
ID_ASC
250+
ID_DESC
251+
NATURAL
252+
PRIMARY_KEY_ASC
253+
PRIMARY_KEY_DESC
254+
PROJECT_ID_ASC
255+
PROJECT_ID_DESC
256+
}
257+
183258
"""All input for the `approveParticipant` mutation."""
184259
input ApproveParticipantInput {
185260
"""
@@ -1163,6 +1238,10 @@ type CopySketchTocItemResults {
11631238
updatedCollection: Sketch
11641239
}
11651240

1241+
type CreateApiKeyResponse {
1242+
token: String!
1243+
}
1244+
11661245
"""All input for the create `Basemap` mutation."""
11671246
input CreateBasemapInput {
11681247
"""The `Basemap` to be created by this mutation."""
@@ -7849,6 +7928,7 @@ type Mutation {
78497928
input: CopySketchFolderInput!
78507929
): CopySketchFolderPayload
78517930
copySketchTocItem(forForum: Boolean, id: Int!, type: SketchChildType!): CopySketchTocItemResults
7931+
createApiKey(label: String!, projectId: Int!, ttlMs: Int): CreateApiKeyResponse!
78527932

78537933
"""Creates a single `Basemap`."""
78547934
createBasemap(
@@ -8860,6 +8940,12 @@ type Mutation {
88608940
"""
88618941
input: RevokeAdminAccessInput!
88628942
): RevokeAdminAccessPayload
8943+
revokeApiKey(
8944+
"""
8945+
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
8946+
"""
8947+
input: RevokeApiKeyInput!
8948+
): RevokeApiKeyPayload
88638949
rollbackToArchivedSource(
88648950
"""
88658951
The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
@@ -10315,6 +10401,35 @@ type Project implements Node {
1031510401
offset: Int
1031610402
): [User!]
1031710403

10404+
"""Reads and enables pagination through a set of `ApiKey`."""
10405+
apiKeysConnection(
10406+
"""Read all values in the set after (below) this cursor."""
10407+
after: Cursor
10408+
10409+
"""Read all values in the set before (above) this cursor."""
10410+
before: Cursor
10411+
10412+
"""
10413+
A condition to be used in determining which values should be returned by the collection.
10414+
"""
10415+
condition: ApiKeyCondition
10416+
10417+
"""Only read the first `n` values of the set."""
10418+
first: Int
10419+
10420+
"""Only read the last `n` values of the set."""
10421+
last: Int
10422+
10423+
"""
10424+
Skip the first `n` values from our `after` cursor, an alternative to cursor
10425+
based pagination. May not be used with `last`.
10426+
"""
10427+
offset: Int
10428+
10429+
"""The method to use when ordering `ApiKey`."""
10430+
orderBy: [ApiKeysOrderBy!] = [PRIMARY_KEY_ASC]
10431+
): ApiKeysConnection!
10432+
1031810433
"""Reads and enables pagination through a set of `Basemap`."""
1031910434
basemaps(
1032010435
"""Only read the first `n` values of the set."""
@@ -11543,6 +11658,42 @@ type Query implements Node {
1154311658
offset: Int
1154411659
period: ActivityStatsPeriod
1154511660
): [Project!]
11661+
apiKey(id: UUID!): ApiKey
11662+
11663+
"""Reads a single `ApiKey` using its globally unique `ID`."""
11664+
apiKeyByNodeId(
11665+
"""The globally unique `ID` to be used in selecting a single `ApiKey`."""
11666+
nodeId: ID!
11667+
): ApiKey
11668+
11669+
"""Reads and enables pagination through a set of `ApiKey`."""
11670+
apiKeysConnection(
11671+
"""Read all values in the set after (below) this cursor."""
11672+
after: Cursor
11673+
11674+
"""Read all values in the set before (above) this cursor."""
11675+
before: Cursor
11676+
11677+
"""
11678+
A condition to be used in determining which values should be returned by the collection.
11679+
"""
11680+
condition: ApiKeyCondition
11681+
11682+
"""Only read the first `n` values of the set."""
11683+
first: Int
11684+
11685+
"""Only read the last `n` values of the set."""
11686+
last: Int
11687+
11688+
"""
11689+
Skip the first `n` values from our `after` cursor, an alternative to cursor
11690+
based pagination. May not be used with `last`.
11691+
"""
11692+
offset: Int
11693+
11694+
"""The method to use when ordering `ApiKey`."""
11695+
orderBy: [ApiKeysOrderBy!] = [PRIMARY_KEY_ASC]
11696+
): ApiKeysConnection
1154611697
archivedDataSource(dataLayerId: Int!, dataSourceId: Int!, version: Int!): ArchivedDataSource
1154711698

1154811699
"""Reads a single `ArchivedDataSource` using its globally unique `ID`."""
@@ -12707,6 +12858,30 @@ type RevokeAdminAccessPayload {
1270712858
query: Query
1270812859
}
1270912860

12861+
"""All input for the `revokeApiKey` mutation."""
12862+
input RevokeApiKeyInput {
12863+
"""
12864+
An arbitrary string value with no semantic meaning. Will be included in the
12865+
payload verbatim. May be used to track mutations by the client.
12866+
"""
12867+
clientMutationId: String
12868+
id: UUID
12869+
}
12870+
12871+
"""The output of our `revokeApiKey` mutation."""
12872+
type RevokeApiKeyPayload {
12873+
"""
12874+
The exact same `clientMutationId` that was provided in the mutation input,
12875+
unchanged and unused. May be used by a client to track mutations.
12876+
"""
12877+
clientMutationId: String
12878+
12879+
"""
12880+
Our root query field type. Allows us to run any query from our mutation payload.
12881+
"""
12882+
query: Query
12883+
}
12884+
1271012885
"""All input for the `rollbackToArchivedSource` mutation."""
1271112886
input RollbackToArchivedSourceInput {
1271212887
"""
@@ -17102,6 +17277,35 @@ used to accept project invite tokens.
1710217277
"""
1710317278
type User implements Node {
1710417279
accessRequestDenied(slug: String): Boolean
17280+
17281+
"""Reads and enables pagination through a set of `ApiKey`."""
17282+
apiKeysByCreatedByConnection(
17283+
"""Read all values in the set after (below) this cursor."""
17284+
after: Cursor
17285+
17286+
"""Read all values in the set before (above) this cursor."""
17287+
before: Cursor
17288+
17289+
"""
17290+
A condition to be used in determining which values should be returned by the collection.
17291+
"""
17292+
condition: ApiKeyCondition
17293+
17294+
"""Only read the first `n` values of the set."""
17295+
first: Int
17296+
17297+
"""Only read the last `n` values of the set."""
17298+
last: Int
17299+
17300+
"""
17301+
Skip the first `n` values from our `after` cursor, an alternative to cursor
17302+
based pagination. May not be used with `last`.
17303+
"""
17304+
offset: Int
17305+
17306+
"""The method to use when ordering `ApiKey`."""
17307+
orderBy: [ApiKeysOrderBy!] = [PRIMARY_KEY_ASC]
17308+
): ApiKeysConnection!
1710517309
approvedBy(projectId: Int): User
1710617310
approvedOrDeniedOn(projectId: Int): Datetime
1710717311

0 commit comments

Comments
 (0)