Skip to content

Commit

Permalink
feat: add User Type API (generated by swagger-codegen)
Browse files Browse the repository at this point in the history
OKTA-453803
<<<Jenkins Check-In of Tested SHA: 42fcfb8 for eng_productivity_ci_bot_okta@okta.com>>>
Artifact: okta-sdk-nodejs
Files changed count: 41
PR Link: "#305"
  • Loading branch information
oleksandrpravosudko-okta authored and eng-prod-CI-bot-okta committed Mar 15, 2022
1 parent 3b95fbd commit 4bf219e
Show file tree
Hide file tree
Showing 41 changed files with 2,494 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ test-reports/
.yalc
yalc.lock

src/v3/.swagger-codegen/
src/v3/.gitignore
src/v3/.npmignore
src/v3/.swagger-codegen-ignore
src/v3/git_push.sh
src/v3/README.md
src/v3/tsconfig.json
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,14 @@ This version 4.0 release also updated APIs latest `@okta/openapi` (v2.0.0) that

Run `yarn build` from repository root.

### Building with swagger-codegen
- Obtain OASv3 combined spec
- Install [swagger-codegen](https://github.com/swagger-api/swagger-codegen/tree/3.0.0#homebrew)
- run `swagger-codegen generate -i ./path/to/specfile.yaml|json -o ./src/v3 -l typescript-axios -t ./templates/swagger-codegen`
- remove APIs and models which are not intended to be pushed to upstream from `src/v3`
- run `./scripts/emitV3Types.sh` to replace TypeScript modules with typings + javascript modules
- commit changes

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) if you would like to propose changes to this library.
Expand Down
3 changes: 3 additions & 0 deletions scripts/emitV3Types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tsc src/v3/**/*.ts --declaration
rsync -r src/v3/**/*.d.ts src/types/v3
find src/v3/ -type f ! -name "*.js" -delete
2 changes: 2 additions & 0 deletions src/configuration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// no js code for V2Configuration, it is only used as a type in TypeScript modules
module.exports = {};
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ module.exports = Object.assign(
DefaultRequestExecutor: require('./default-request-executor'),
Collection: require('./collection'),
},
require('./models')
require('./models'),
require('./v3')
);
18 changes: 2 additions & 16 deletions src/types/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,10 @@ import { ParameterizedOperationsClient } from './parameterized-operations-client
import { OAuth } from './oauth';
import { Http } from './http';
import { RequestExecutor } from './request-executor';
import { defaultCacheMiddleware } from './default-cache-middleware';
import { CacheStorage } from './memory-store';

import { V2Configuration } from './configuration';

export declare class Client extends ParameterizedOperationsClient {
constructor(config?: {
orgUrl?: string,
token?: string,
clientId?: string,
scopes?: string[],
requestExecutor?: RequestExecutor,
authorizationMode?: string,
privateKey?: string | Record<string, unknown>
cacheStore?: CacheStorage,
cacheMiddleware?: typeof defaultCacheMiddleware | unknown
defaultCacheMiddlewareResponseBufferSize?: number,
httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56
});
constructor(config?: V2Configuration);

requestExecutor: RequestExecutor;
authorizationMode: string;
Expand Down
3 changes: 2 additions & 1 deletion src/types/config-loader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export declare class ConfigLoader {
token: string;
clientId: string;
scopes: string;
privateKey: string;
privateKey?: string;
userAgent?: string;
};
};
applyDefaults(): void;
Expand Down
15 changes: 15 additions & 0 deletions src/types/configuration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defaultCacheMiddleware } from './default-cache-middleware';
import { RequestExecutor } from './request-executor';

export declare interface V2Configuration {
orgUrl?: string,
token?: string,
clientId?: string,
scopes?: string[],
requestExecutor?: RequestExecutor,
authorizationMode?: string,
privateKey?: string | Record<string, unknown>
cacheStore?: CacheStorage,
cacheMiddleware?: typeof defaultCacheMiddleware | unknown
defaultCacheMiddlewareResponseBufferSize?: number,
}
3 changes: 2 additions & 1 deletion src/types/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export declare class Http {
oauth: OAuth,
cacheStore?: CacheStorage,
cacheMiddleware?: typeof defaultCacheMiddleware | unknown,
httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56
httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56,
defaultCacheMiddlewareResponseBufferSize?: number,
});
defaultHeaders: Record<string, unknown>;
requestExecutor: RequestExecutor;
Expand Down
1 change: 1 addition & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export * from './request-options/SecurePasswordStoreApplicationOptions';
export * from './request-options/SwaApplicationOptions';
export * from './request-options/SwaThreeFieldApplicationOptions';
export * from './request-options/WsFederationApplicationOptions';
export * from './v3';

export * from './models/AccessPolicy';
export * from './models/AccessPolicyConstraint';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ declare interface SecurePasswordStoreApplicationOptions {
export {
SecurePasswordStoreApplicationOptions
};

12 changes: 12 additions & 0 deletions src/types/v3/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Okta API
* Allows customers to easily access the Okta API
*
* OpenAPI spec version: 2.10.0
* Contact: devex-public@okta.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export * from './apis/user-type-api';
246 changes: 246 additions & 0 deletions src/types/v3/apis/user-type-api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
/**
* Okta API
* Allows customers to easily access the Okta API
*
* OpenAPI spec version: 2.10.0
* Contact: devex-public@okta.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { RequestArgs, BaseAPI } from '../base';
import { UserType } from '../models';
import { Response } from 'node-fetch';
import Http = require('../../http');
import { V2Configuration } from '../../configuration';
import { Configuration } from '../configuration';
/**
* UserTypeApi - request parameter creator
* @export
*/
export declare const UserTypeApiRequestParamCreator: (configuration?: Configuration & V2Configuration) => {
httpClient: any;
/**
* Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10.
* @summary Create User Type
* @param {UserType} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUserType: (body: UserType, options?: any) => Promise<RequestArgs>;
/**
* Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users
* @summary Delete User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUserType: (typeId: string, options?: any) => Promise<RequestArgs>;
/**
* Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type.
* @summary Get User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getUserType: (typeId: string, options?: any) => Promise<RequestArgs>;
/**
* Fetches all User Types in your org
* @summary List User Types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listUserTypes: (options?: any) => Promise<RequestArgs>;
/**
* Replace an existing User Type
* @summary Replace User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
replaceUserType: (body: UserType, typeId: string, options?: any) => Promise<RequestArgs>;
/**
* Updates an existing User Type
* @summary Update User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateUserType: (body: UserType, typeId: string, options?: any) => Promise<RequestArgs>;
};
/**
* UserTypeApi - functional programming interface
* @export
*/
export declare const UserTypeApiFp: (configuration?: Configuration & V2Configuration) => {
/**
* Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10.
* @summary Create User Type
* @param {UserType} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUserType(body: UserType, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise<UserType>>;
/**
* Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users
* @summary Delete User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUserType(typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise<Response>>;
/**
* Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type.
* @summary Get User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getUserType(typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise<UserType>>;
/**
* Fetches all User Types in your org
* @summary List User Types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listUserTypes(options?: any): Promise<(httpClient?: any, basePath?: string) => Promise<Array<UserType>>>;
/**
* Replace an existing User Type
* @summary Replace User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
replaceUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise<UserType>>;
/**
* Updates an existing User Type
* @summary Update User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise<UserType>>;
};
/**
* UserTypeApi - factory interface
* @export
*/
export declare const UserTypeApiFactory: (configuration?: Configuration, basePath?: string, httpClient?: any) => {
/**
* Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10.
* @summary Create User Type
* @param {UserType} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUserType(body: UserType, options?: any): Promise<UserType>;
/**
* Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users
* @summary Delete User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUserType(typeId: string, options?: any): Promise<Response>;
/**
* Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type.
* @summary Get User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getUserType(typeId: string, options?: any): Promise<UserType>;
/**
* Fetches all User Types in your org
* @summary List User Types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listUserTypes(options?: any): Promise<Array<UserType>>;
/**
* Replace an existing User Type
* @summary Replace User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
replaceUserType(body: UserType, typeId: string, options?: any): Promise<UserType>;
/**
* Updates an existing User Type
* @summary Update User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateUserType(body: UserType, typeId: string, options?: any): Promise<UserType>;
};
/**
* UserTypeApi - object-oriented interface
* @export
* @class UserTypeApi
* @extends {BaseAPI}
*/
export declare class UserTypeApi extends BaseAPI {
/**
* Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10.
* @summary Create User Type
* @param {UserType} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserTypeApi
*/
createUserType(body: UserType, options?: any): Promise<UserType>;
/**
* Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users
* @summary Delete User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserTypeApi
*/
deleteUserType(typeId: string, options?: any): Promise<Response>;
/**
* Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type.
* @summary Get User Type
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserTypeApi
*/
getUserType(typeId: string, options?: any): Promise<UserType>;
/**
* Fetches all User Types in your org
* @summary List User Types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserTypeApi
*/
listUserTypes(options?: any): Promise<UserType[]>;
/**
* Replace an existing User Type
* @summary Replace User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserTypeApi
*/
replaceUserType(body: UserType, typeId: string, options?: any): Promise<UserType>;
/**
* Updates an existing User Type
* @summary Update User Type
* @param {UserType} body
* @param {string} typeId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserTypeApi
*/
updateUserType(body: UserType, typeId: string, options?: any): Promise<UserType>;
}
Loading

0 comments on commit 4bf219e

Please sign in to comment.