Skip to content

Commit fcacb00

Browse files
authored
🤖 Merge PR DefinitelyTyped#66399 Add support for include_totals to getClients method by @daveykane
1 parent 3d31e45 commit fcacb00

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed

‎types/auth0/auth0-tests.ts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,18 @@ management
466466
// Handle the error
467467
});
468468

469+
// Get all clients with pagination and totals using a callback
470+
management.getClients({ page: 0, per_page: 5, include_totals: true }, (err, pagedClients) => {
471+
// $ExpectType ClientsPaged
472+
pagedClients;
473+
});
474+
475+
// Get all clients with pagination and totals returning a Promise
476+
management.getClients({ page: 0, per_page: 5, include_totals: true }).then(pagedClients => {
477+
// $ExpectType ClientsPaged
478+
pagedClients;
479+
});
480+
469481
// Connections
470482
// Get all Connections with promise
471483
management
@@ -1284,14 +1296,21 @@ management.organizations.getByName({ name: '' }).then((organization: auth0.Organ
12841296
/**
12851297
* Create an Organization using a callback
12861298
*/
1287-
management.organizations.create({
1288-
name: 'test_organization', display_name: 'Test Organization', enabled_connections: [{
1289-
connection_id: 'connection-id',
1290-
assign_membership_on_login: true,
1291-
}]
1292-
}, (err, organization: auth0.Organization) => {
1293-
console.log({ organization });
1294-
});
1299+
management.organizations.create(
1300+
{
1301+
name: 'test_organization',
1302+
display_name: 'Test Organization',
1303+
enabled_connections: [
1304+
{
1305+
connection_id: 'connection-id',
1306+
assign_membership_on_login: true,
1307+
},
1308+
],
1309+
},
1310+
(err, organization: auth0.Organization) => {
1311+
console.log({ organization });
1312+
},
1313+
);
12951314

12961315
/**
12971316
* Create an Organization returning a Promise

‎types/auth0/index.d.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ export interface Client {
317317
initiate_login_uri?: string | undefined;
318318
}
319319

320+
export interface ClientsPaged extends Omit<Page, 'length'> {
321+
clients: Client[];
322+
}
323+
320324
export interface ResourceServer {
321325
/**
322326
* The identifier of the resource server.
@@ -1569,19 +1573,19 @@ export interface UsersLogsQuery {
15691573
interface LogStreamBase {
15701574
id: string;
15711575
name: string;
1572-
status: "active" | "paused" | "suspended";
1576+
status: 'active' | 'paused' | 'suspended';
15731577
}
15741578

15751579
interface DatadogLogStream extends LogStreamBase {
1576-
type: "datadog";
1580+
type: 'datadog';
15771581
sink: {
15781582
datadogRegion: string;
15791583
datadogApiKey: string;
15801584
};
15811585
}
15821586

15831587
interface EventBridgeLogStream extends LogStreamBase {
1584-
type: "eventbridge";
1588+
type: 'eventbridge';
15851589
sink: {
15861590
awsAccountId: string;
15871591
awsRegion: string;
@@ -1590,7 +1594,7 @@ interface EventBridgeLogStream extends LogStreamBase {
15901594
}
15911595

15921596
interface EventGridLogStream extends LogStreamBase {
1593-
type: "eventgrid";
1597+
type: 'eventgrid';
15941598
sink: {
15951599
azureSubscriptionId: string;
15961600
azureResourceGroup: string;
@@ -1600,17 +1604,17 @@ interface EventGridLogStream extends LogStreamBase {
16001604
}
16011605

16021606
interface HttpLogStream extends LogStreamBase {
1603-
type: "http";
1607+
type: 'http';
16041608
sink: {
1605-
httpContentFormat: "JSONLINES" | "JSONARRAY";
1609+
httpContentFormat: 'JSONLINES' | 'JSONARRAY';
16061610
httpContentType: string;
16071611
httpEndpoint: string;
16081612
httpAuthorization: string;
16091613
};
16101614
}
16111615

16121616
interface SplunkLogStream extends LogStreamBase {
1613-
type: "splunk";
1617+
type: 'splunk';
16141618
sink: {
16151619
splunkDomain: string;
16161620
splunkToken: string;
@@ -1620,7 +1624,7 @@ interface SplunkLogStream extends LogStreamBase {
16201624
}
16211625

16221626
interface SumoLogStream extends LogStreamBase {
1623-
type: "sumo";
1627+
type: 'sumo';
16241628
sink: {
16251629
sumoSourceAddress: string;
16261630
};
@@ -1868,9 +1872,18 @@ export class ManagementClient<A = AppMetadata, U = UserMetadata> {
18681872
updateConnection(params: ObjectWithId, data: UpdateConnection): Promise<Connection>;
18691873

18701874
// Clients
1871-
getClients(params?: GetClientsOptions): Promise<Client[]>;
1875+
getClients(): Promise<Client[]>;
18721876
getClients(cb: (err: Error, clients: Client[]) => void): void;
1873-
getClients(params: GetClientsOptions, cb: (err: Error, clients: Client[]) => void): void;
1877+
getClients(params: GetClientsOptions & { include_totals?: false }): Promise<Client[]>;
1878+
getClients(params: GetClientsOptions & { include_totals: true }): Promise<ClientsPaged>;
1879+
getClients(
1880+
params: GetClientsOptions & { include_totals?: false },
1881+
cb: (err: Error, clients: Client[]) => void,
1882+
): void;
1883+
getClients(
1884+
params: GetClientsOptions & { include_totals: true },
1885+
cb: (err: Error, pagedClients: ClientsPaged) => void,
1886+
): void;
18741887

18751888
getClient(params: ClientParams): Promise<Client>;
18761889
getClient(params: ClientParams, cb: (err: Error, client: Client) => void): void;

0 commit comments

Comments
 (0)