Skip to content

Commit e277a7e

Browse files
committed
feat(cli,api): fix the first-run golden path from login to projects list (#1178)
Synced from sferarc/pgbeam@06f9609
1 parent a2010ce commit e277a7e

7 files changed

Lines changed: 193 additions & 1 deletion

File tree

openapi.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,34 @@
22262226
}
22272227
}
22282228
},
2229+
"/v1/organizations": {
2230+
"get": {
2231+
"operationId": "listOrganizations",
2232+
"summary": "List organizations",
2233+
"description": "Lists the organizations visible to the caller's credential. An organization-scoped API key (pbo_) returns exactly the organization it belongs to. A user credential (account-scoped API key or dashboard session token) returns the organizations the user is a member of, including the caller's role in each.",
2234+
"tags": [
2235+
"Account"
2236+
],
2237+
"responses": {
2238+
"200": {
2239+
"description": "Organizations visible to the caller.",
2240+
"content": {
2241+
"application/json": {
2242+
"schema": {
2243+
"$ref": "#/components/schemas/ListOrganizationsResponse"
2244+
}
2245+
}
2246+
}
2247+
},
2248+
"401": {
2249+
"$ref": "#/components/responses/Unauthorized"
2250+
},
2251+
"429": {
2252+
"$ref": "#/components/responses/TooManyRequests"
2253+
}
2254+
}
2255+
}
2256+
},
22292257
"/v1/projects/{project_id}/policies": {
22302258
"parameters": [
22312259
{
@@ -6734,6 +6762,53 @@
67346762
}
67356763
}
67366764
},
6765+
"OrganizationSummary": {
6766+
"type": "object",
6767+
"description": "An organization visible to the caller's credential.",
6768+
"required": [
6769+
"id",
6770+
"name",
6771+
"slug"
6772+
],
6773+
"properties": {
6774+
"id": {
6775+
"type": "string",
6776+
"description": "Organization identifier.",
6777+
"example": "org_abc123"
6778+
},
6779+
"name": {
6780+
"type": "string",
6781+
"description": "Organization display name.",
6782+
"example": "Acme Corp"
6783+
},
6784+
"slug": {
6785+
"type": "string",
6786+
"description": "Organization slug used in URLs and routing.",
6787+
"example": "acme-corp"
6788+
},
6789+
"role": {
6790+
"type": "string",
6791+
"description": "The caller's role within the organization. Omitted for organization-scoped API keys, which act as the organization itself rather than as a member.",
6792+
"example": "owner"
6793+
}
6794+
}
6795+
},
6796+
"ListOrganizationsResponse": {
6797+
"type": "object",
6798+
"description": "Organizations visible to the caller's credential.",
6799+
"required": [
6800+
"organizations"
6801+
],
6802+
"properties": {
6803+
"organizations": {
6804+
"type": "array",
6805+
"description": "Organizations the caller can access.",
6806+
"items": {
6807+
"$ref": "#/components/schemas/OrganizationSummary"
6808+
}
6809+
}
6810+
}
6811+
},
67376812
"PiiSuggestion": {
67386813
"type": "object",
67396814
"description": "A single likely-PII column detected by the scanner, with a recommended masking rule. Suggestions are advisory only — nothing is applied until the operator reviews and adds it to a policy profile.",

openapi.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,27 @@ paths:
14121412
$ref: '#/components/responses/NotFound'
14131413
'429':
14141414
$ref: '#/components/responses/TooManyRequests'
1415+
/v1/organizations:
1416+
get:
1417+
operationId: listOrganizations
1418+
summary: List organizations
1419+
description: >-
1420+
Lists the organizations visible to the caller's credential. An organization-scoped API key (pbo_) returns
1421+
exactly the organization it belongs to. A user credential (account-scoped API key or dashboard session token)
1422+
returns the organizations the user is a member of, including the caller's role in each.
1423+
tags:
1424+
- Account
1425+
responses:
1426+
'200':
1427+
description: Organizations visible to the caller.
1428+
content:
1429+
application/json:
1430+
schema:
1431+
$ref: '#/components/schemas/ListOrganizationsResponse'
1432+
'401':
1433+
$ref: '#/components/responses/Unauthorized'
1434+
'429':
1435+
$ref: '#/components/responses/TooManyRequests'
14151436
/v1/projects/{project_id}/policies:
14161437
parameters:
14171438
- $ref: '#/components/parameters/ProjectId'
@@ -4711,6 +4732,43 @@ components:
47114732
dismiss:
47124733
type: boolean
47134734
description: Set to true to dismiss the onboarding checklist.
4735+
OrganizationSummary:
4736+
type: object
4737+
description: An organization visible to the caller's credential.
4738+
required:
4739+
- id
4740+
- name
4741+
- slug
4742+
properties:
4743+
id:
4744+
type: string
4745+
description: Organization identifier.
4746+
example: org_abc123
4747+
name:
4748+
type: string
4749+
description: Organization display name.
4750+
example: Acme Corp
4751+
slug:
4752+
type: string
4753+
description: Organization slug used in URLs and routing.
4754+
example: acme-corp
4755+
role:
4756+
type: string
4757+
description: >-
4758+
The caller's role within the organization. Omitted for organization-scoped API keys, which act as the
4759+
organization itself rather than as a member.
4760+
example: owner
4761+
ListOrganizationsResponse:
4762+
type: object
4763+
description: Organizations visible to the caller's credential.
4764+
required:
4765+
- organizations
4766+
properties:
4767+
organizations:
4768+
type: array
4769+
description: Organizations the caller can access.
4770+
items:
4771+
$ref: '#/components/schemas/OrganizationSummary'
47144772
PiiSuggestion:
47154773
type: object
47164774
description: >-
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type: object
2+
description: Organizations visible to the caller's credential.
3+
required:
4+
- organizations
5+
properties:
6+
organizations:
7+
type: array
8+
description: Organizations the caller can access.
9+
items:
10+
$ref: ./OrganizationSummary.yaml
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
type: object
2+
description: An organization visible to the caller's credential.
3+
required:
4+
- id
5+
- name
6+
- slug
7+
properties:
8+
id:
9+
type: string
10+
description: Organization identifier.
11+
example: org_abc123
12+
name:
13+
type: string
14+
description: Organization display name.
15+
example: Acme Corp
16+
slug:
17+
type: string
18+
description: Organization slug used in URLs and routing.
19+
example: acme-corp
20+
role:
21+
type: string
22+
description: >-
23+
The caller's role within the organization. Omitted for organization-scoped
24+
API keys, which act as the organization itself rather than as a member.
25+
example: owner

spec/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ paths:
137137
$ref: paths/v1_projects_{project_id}_migrations:lint.yaml
138138
/v1/organizations/{org_id}/onboarding:
139139
$ref: paths/v1_organizations_{org_id}_onboarding.yaml
140+
/v1/organizations:
141+
$ref: paths/v1_organizations.yaml
140142
/v1/projects/{project_id}/policies:
141143
$ref: paths/v1_projects_{project_id}_policies.yaml
142144
/v1/projects/{project_id}/policies/{policy_id}:

spec/paths/v1_organizations.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
get:
2+
operationId: listOrganizations
3+
summary: List organizations
4+
description: >-
5+
Lists the organizations visible to the caller's credential. An
6+
organization-scoped API key (pbo_) returns exactly the organization it
7+
belongs to. A user credential (account-scoped API key or dashboard session
8+
token) returns the organizations the user is a member of, including the
9+
caller's role in each.
10+
tags:
11+
- Account
12+
responses:
13+
'200':
14+
description: Organizations visible to the caller.
15+
content:
16+
application/json:
17+
schema:
18+
$ref: ../components/schemas/ListOrganizationsResponse.yaml
19+
'401':
20+
$ref: ../components/responses/Unauthorized.yaml
21+
'429':
22+
$ref: ../components/responses/TooManyRequests.yaml

src/spec.gen.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)