FusionAuth / fusionauth-typescript-client

A TypeScript client for FusionAuth
https://fusionauth.io
Apache License 2.0
65 stars 27 forks source link

typescript definition lists all arguments as required when many are optional #29

Open paustint opened 4 years ago

paustint commented 4 years ago

The documentation for many functions (such as exchangeRefreshTokenForAccessToken) clearly states that many arguments are optional properties, but the typescript definition file lists all arguments as required.

The typescript functions should match the documentation so that users do not have to pass in null or undefined as arguments to avoid compiler errors.

Here is an example:

/**
     * Exchange a Refresh Token for an Access Token.
     * If you will be using the Refresh Token Grant, you will make a request to the Token endpoint to exchange the user’s refresh token for an access token.
     *
     * @param {string} refresh_token The refresh token that you would like to use to exchange for an access token.
     * @param {string} client_id (Optional) The unique client identifier. The client Id is the Id of the FusionAuth Application in which you you are attempting to authenticate. This parameter is optional when the Authorization header is provided.
     * @param {string} client_secret (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.
     * @param {string} scope (Optional) This parameter is optional and if omitted, the same scope requested during the authorization request will be used. If provided the scopes must match those requested during the initial authorization request.
     * @param {string} user_code (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
     * @returns {Promise<ClientResponse<AccessToken>>}
     */
    exchangeRefreshTokenForAccessToken(refresh_token: string, client_id: string, client_secret: string, scope: string, user_code: string): Promise<ClientResponse<AccessToken>>;
lancegliser commented 1 year ago

This seems to be the same issue as #19