Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing parameters of non-model types into generated client methods #235

Closed
wants to merge 11 commits into from

Conversation

oleksandrpravosudko-okta
Copy link
Contributor

@oleksandrpravosudko-okta oleksandrpravosudko-okta commented Apr 2, 2021

  • derive weak types from models to be used for passing into Client methods
  • remove IRequestExecutor interface
  • add url property to RequestOptions interface

@@ -13,7 +13,7 @@
import { GeneratedApiClient } from './generated-client';
import { OAuth } from './oauth';
import { Http } from './http';
import { IRequestExecutor } from './request-executor';
import { RequestExecutor } from './request-executor';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a type name change? Looks like a breaking change

@@ -769,6 +769,30 @@ const client = new okta.Client({
})
```

### TypeScript usage examples (>=4.5.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add one more example for the newly introduced optional model type?

export {
AcsEndpoint
AcsEndpoint,
AcsEndpointOptionsType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about name it as xxxOptionalType?

@shuowu
Copy link
Contributor

shuowu commented Apr 6, 2021

Looks good to me in general. Can we put the type breaking change (remove IRequestExecutor interface) for next major version update?

@oleksandrpravosudko-okta oleksandrpravosudko-okta marked this pull request as ready for review April 8, 2021 03:47
@@ -2,7 +2,7 @@ import { expectError, expectType } from 'tsd';
import { Response } from 'node-fetch';
import { Client } from '../../src/types/client';
import { Collection } from '../../src/types/collection';
import { Application } from '../../src/types/models/Application';
import { Application, ApplicationOptionsType } from '../../src/types/models/Application';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be ApplicationOptions?

@@ -16,3 +16,9 @@ expectError(client.deleteApplicationUser('appId', 'userId', {sendEmail: 0}));
// Client methods return either Promise or Collection
expectType<Promise<Response>>(client.deletePolicy('policyId'));
expectType<Collection<Application>>(client.listApplications());

// methods expecting body request parameters
const appOptions: ApplicationOptionsType = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

README.md Outdated
}
};

client.createApplication(bookmarkApp).then((createdApp: Application) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: bookmarkApp -> bookmarkAppOptions

@oleksandrpravosudko-okta oleksandrpravosudko-okta changed the base branch from master to 4.5 April 8, 2021 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants