Skip to content

Commit

Permalink
clients/licensekeys: fix licensekey api
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwidlund committed Nov 13, 2024
1 parent ad8dd7f commit 4033209
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const ClientPage = ({

const { data: licenseKeys, isLoading } = useOrganizationLicenseKeys({
organizationId: organization.id,
benefitIds: selectedBenefitId ? [selectedBenefitId] : undefined,
benefitIds: selectedBenefitId,
...getAPIParams(pagination, sorting),
})

Expand Down
6 changes: 3 additions & 3 deletions clients/apps/web/src/hooks/queries/license_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const useLicenseKeyDeactivation = (licenseKeyId: string) =>

export const useOrganizationLicenseKeys = ({
organizationId,
benefitId,
benefitIds,
page,
limit,
}: LicenseKeysApiListRequest) =>
Expand All @@ -65,12 +65,12 @@ export const useOrganizationLicenseKeys = ({
'license_keys',
'organization',
organizationId,
{ page, limit, benefitId },
{ page, limit, benefitIds },
],
queryFn: () =>
api.licenseKeys.list({
organizationId,
benefitId,
benefitIds,
page,
limit,
}),
Expand Down
70 changes: 58 additions & 12 deletions clients/packages/sdk/openapi/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,14 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"Anonymous",
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "github_authorize",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/callback": {
Expand Down Expand Up @@ -2756,7 +2763,14 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"Anonymous",
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "github_callback",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/lookup_user": {
Expand Down Expand Up @@ -2806,7 +2820,13 @@
{
"pat": []
}
]
],
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "lookup_user",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/organizations/{id}/installation": {
Expand Down Expand Up @@ -2878,7 +2898,13 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "redirect_to_organization_installation",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/organizations/{id}/check_permissions": {
Expand Down Expand Up @@ -2939,7 +2965,13 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "check_organization_permissions",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/organizations/{id}/billing": {
Expand Down Expand Up @@ -2997,7 +3029,13 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "get_organization_billing_plan",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/installations": {
Expand Down Expand Up @@ -3047,7 +3085,13 @@
{
"pat": []
}
]
],
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "install",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/webhook": {
Expand All @@ -3069,7 +3113,10 @@
}
}
}
}
},
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "webhook",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github_repository_benefit/user/authorize": {
Expand Down Expand Up @@ -11223,7 +11270,7 @@
"get": {
"tags": [
"oauth2",
"private"
"documented"
],
"summary": "Authorize",
"operationId": "oauth2:authorize",
Expand Down Expand Up @@ -11267,8 +11314,7 @@
"User"
],
"x-speakeasy-group": "oauth2",
"x-speakeasy-name-override": "authorize",
"x-speakeasy-ignore": true
"x-speakeasy-name-override": "authorize"
}
},
"/v1/oauth2/consent": {
Expand Down Expand Up @@ -15677,7 +15723,7 @@
"description": "Filter by organization ID."
},
{
"name": "benefit_id",
"name": "benefit_ids",
"in": "query",
"required": false,
"schema": {
Expand Down
68 changes: 57 additions & 11 deletions clients/packages/sdk/openapi/updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,14 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"Anonymous",
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "github_authorize",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/callback": {
Expand Down Expand Up @@ -2690,7 +2697,14 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"Anonymous",
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "github_callback",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/lookup_user": {
Expand Down Expand Up @@ -2739,7 +2753,13 @@
{
"pat": []
}
]
],
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "lookup_user",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/organizations/{id}/installation": {
Expand Down Expand Up @@ -2810,7 +2830,13 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "redirect_to_organization_installation",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/organizations/{id}/check_permissions": {
Expand Down Expand Up @@ -2870,7 +2896,13 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "check_organization_permissions",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/organizations/{id}/billing": {
Expand Down Expand Up @@ -2927,7 +2959,13 @@
}
}
}
}
},
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "get_organization_billing_plan",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/installations": {
Expand Down Expand Up @@ -2976,7 +3014,13 @@
{
"pat": []
}
]
],
"x-polar-allowed-subjects": [
"User"
],
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "install",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github/webhook": {
Expand All @@ -2997,7 +3041,10 @@
}
}
}
}
},
"x-speakeasy-group": "integrations_github",
"x-speakeasy-name-override": "webhook",
"x-speakeasy-ignore": true
}
},
"/v1/integrations/github_repository_benefit/user/authorize": {
Expand Down Expand Up @@ -11071,8 +11118,7 @@
"User"
],
"x-speakeasy-group": "oauth2",
"x-speakeasy-name-override": "authorize",
"x-speakeasy-ignore": true
"x-speakeasy-name-override": "authorize"
}
},
"/v1/oauth2/consent": {
Expand Down Expand Up @@ -15408,7 +15454,7 @@
"description": "Filter by organization ID."
},
{
"name": "benefit_id",
"name": "benefit_ids",
"in": "query",
"required": false,
"schema": {
Expand Down
6 changes: 3 additions & 3 deletions clients/packages/sdk/src/client/apis/LicenseKeysApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface LicenseKeysApiGetActivationRequest {

export interface LicenseKeysApiListRequest {
organizationId?: OrganizationIDFilter;
benefitId?: BenefitIDFilter2;
benefitIds?: BenefitIDFilter2;
page?: number;
limit?: number;
}
Expand Down Expand Up @@ -157,8 +157,8 @@ export class LicenseKeysApi extends runtime.BaseAPI {
queryParameters['organization_id'] = requestParameters['organizationId'];
}

if (requestParameters['benefitId'] != null) {
queryParameters['benefit_id'] = requestParameters['benefitId'];
if (requestParameters['benefitIds'] != null) {
queryParameters['benefit_ids'] = requestParameters['benefitIds'];
}

if (requestParameters['page'] != null) {
Expand Down
4 changes: 2 additions & 2 deletions server/polar/license_key/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def list(
organization_id: MultipleQueryFilter[OrganizationID] | None = Query(
None, title="OrganizationID Filter", description="Filter by organization ID."
),
benefit_id: MultipleQueryFilter[BenefitID] | None = Query(
benefit_ids: MultipleQueryFilter[BenefitID] | None = Query(
None, title="BenefitID Filter", description="Filter by benefit ID."
),
session: AsyncSession = Depends(get_db_session),
Expand All @@ -58,7 +58,7 @@ async def list(
session,
auth_subject,
organization_ids=organization_id,
benefit_ids=benefit_id,
benefit_ids=benefit_ids,
pagination=pagination,
)

Expand Down

0 comments on commit 4033209

Please sign in to comment.