Init commit for orphan branch "src".
This commit is contained in:
Коммит
6458d7ae9d
|
@ -0,0 +1,4 @@
|
||||||
|
wwwroot/*.js
|
||||||
|
node_modules
|
||||||
|
typings
|
||||||
|
dist
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Swagger Codegen Ignore
|
||||||
|
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
|
@ -0,0 +1 @@
|
||||||
|
2.4.7
|
|
@ -0,0 +1,178 @@
|
||||||
|
## @
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
To install the required dependencies and to build the typescript sources run:
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### publishing
|
||||||
|
|
||||||
|
First build the package than run ```npm publish```
|
||||||
|
|
||||||
|
### consuming
|
||||||
|
|
||||||
|
Navigate to the folder of your consuming project and run one of next commands.
|
||||||
|
|
||||||
|
_published:_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install @ --save
|
||||||
|
```
|
||||||
|
|
||||||
|
_without publishing (not recommended):_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||||
|
```
|
||||||
|
|
||||||
|
_using `npm link`:_
|
||||||
|
|
||||||
|
In PATH_TO_GENERATED_PACKAGE:
|
||||||
|
```
|
||||||
|
npm link
|
||||||
|
```
|
||||||
|
|
||||||
|
In your project:
|
||||||
|
```
|
||||||
|
npm link
|
||||||
|
```
|
||||||
|
|
||||||
|
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
||||||
|
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
|
||||||
|
Published packages are not effected by this issue.
|
||||||
|
|
||||||
|
|
||||||
|
#### General usage
|
||||||
|
|
||||||
|
In your Angular project:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
// without configuring providers
|
||||||
|
import { ApiModule } from '';
|
||||||
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
ApiModule,
|
||||||
|
// make sure to import the HttpClientModule in the AppModule only,
|
||||||
|
// see https://github.com/angular/angular/issues/20575
|
||||||
|
HttpClientModule
|
||||||
|
],
|
||||||
|
declarations: [ AppComponent ],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
// configuring providers
|
||||||
|
import { ApiModule, Configuration, ConfigurationParameters } from '';
|
||||||
|
|
||||||
|
export function apiConfigFactory (): Configuration => {
|
||||||
|
const params: ConfigurationParameters = {
|
||||||
|
// set configuration parameters here.
|
||||||
|
}
|
||||||
|
return new Configuration(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ ApiModule.forRoot(apiConfigFactory) ],
|
||||||
|
declarations: [ AppComponent ],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
import { DefaultApi } from '';
|
||||||
|
|
||||||
|
export class AppComponent {
|
||||||
|
constructor(private apiGateway: DefaultApi) { }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: The ApiModule is restricted to being instantiated once app wide.
|
||||||
|
This is to ensure that all services are treated as singletons.
|
||||||
|
|
||||||
|
#### Using multiple swagger files / APIs / ApiModules
|
||||||
|
In order to use multiple `ApiModules` generated from different swagger files,
|
||||||
|
you can create an alias name when importing the modules
|
||||||
|
in order to avoid naming conflicts:
|
||||||
|
```
|
||||||
|
import { ApiModule } from 'my-api-path';
|
||||||
|
import { ApiModule as OtherApiModule } from 'my-other-api-path';
|
||||||
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
ApiModule,
|
||||||
|
OtherApiModule,
|
||||||
|
// make sure to import the HttpClientModule in the AppModule only,
|
||||||
|
// see https://github.com/angular/angular/issues/20575
|
||||||
|
HttpClientModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AppModule {
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Set service base path
|
||||||
|
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
||||||
|
|
||||||
|
```
|
||||||
|
import { BASE_PATH } from '';
|
||||||
|
|
||||||
|
bootstrap(AppComponent, [
|
||||||
|
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
||||||
|
]);
|
||||||
|
```
|
||||||
|
or
|
||||||
|
|
||||||
|
```
|
||||||
|
import { BASE_PATH } from '';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [],
|
||||||
|
declarations: [ AppComponent ],
|
||||||
|
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Using @angular/cli
|
||||||
|
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
||||||
|
|
||||||
|
```
|
||||||
|
export const environment = {
|
||||||
|
production: false,
|
||||||
|
API_BASE_PATH: 'http://127.0.0.1:8080'
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
In the src/app/app.module.ts:
|
||||||
|
```
|
||||||
|
import { BASE_PATH } from '';
|
||||||
|
import { environment } from '../environments/environment';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
imports: [ ],
|
||||||
|
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
|
```
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
|
import { DefaultService } from './api/default.service';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [],
|
||||||
|
declarations: [],
|
||||||
|
exports: [],
|
||||||
|
providers: [
|
||||||
|
DefaultService ]
|
||||||
|
})
|
||||||
|
export class ApiModule {
|
||||||
|
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
|
||||||
|
return {
|
||||||
|
ngModule: ApiModule,
|
||||||
|
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
||||||
|
@Optional() http: HttpClient) {
|
||||||
|
if (parentModule) {
|
||||||
|
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
||||||
|
}
|
||||||
|
if (!http) {
|
||||||
|
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
||||||
|
'See also https://github.com/angular/angular/issues/20575');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './default.service';
|
||||||
|
import { DefaultService } from './default.service';
|
||||||
|
export const APIS = [DefaultService];
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,79 @@
|
||||||
|
export interface ConfigurationParameters {
|
||||||
|
apiKeys?: {[ key: string ]: string};
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
accessToken?: string | (() => string);
|
||||||
|
basePath?: string;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Configuration {
|
||||||
|
apiKeys?: {[ key: string ]: string};
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
accessToken?: string | (() => string);
|
||||||
|
basePath?: string;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
|
||||||
|
constructor(configurationParameters: ConfigurationParameters = {}) {
|
||||||
|
this.apiKeys = configurationParameters.apiKeys;
|
||||||
|
this.username = configurationParameters.username;
|
||||||
|
this.password = configurationParameters.password;
|
||||||
|
this.accessToken = configurationParameters.accessToken;
|
||||||
|
this.basePath = configurationParameters.basePath;
|
||||||
|
this.withCredentials = configurationParameters.withCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the correct content-type to use for a request.
|
||||||
|
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
||||||
|
* If no content type is found return the first found type if the contentTypes is not empty
|
||||||
|
* @param contentTypes - the array of content types that are available for selection
|
||||||
|
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||||
|
*/
|
||||||
|
public selectHeaderContentType (contentTypes: string[]): string | undefined {
|
||||||
|
if (contentTypes.length == 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
let type = contentTypes.find(x => this.isJsonMime(x));
|
||||||
|
if (type === undefined) {
|
||||||
|
return contentTypes[0];
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the correct accept content-type to use for a request.
|
||||||
|
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
||||||
|
* If no content type is found return the first found type if the contentTypes is not empty
|
||||||
|
* @param accepts - the array of content types that are available for selection.
|
||||||
|
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||||
|
*/
|
||||||
|
public selectHeaderAccept(accepts: string[]): string | undefined {
|
||||||
|
if (accepts.length == 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
let type = accepts.find(x => this.isJsonMime(x));
|
||||||
|
if (type === undefined) {
|
||||||
|
return accepts[0];
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given MIME is a JSON MIME.
|
||||||
|
* JSON MIME examples:
|
||||||
|
* application/json
|
||||||
|
* application/json; charset=UTF8
|
||||||
|
* APPLICATION/JSON
|
||||||
|
* application/vnd.company+json
|
||||||
|
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||||
|
* @return True if the given MIME is JSON, false otherwise.
|
||||||
|
*/
|
||||||
|
public isJsonMime(mime: string): boolean {
|
||||||
|
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||||
|
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { HttpUrlEncodingCodec } from '@angular/common/http';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CustomHttpUrlEncodingCodec
|
||||||
|
* Fix plus sign (+) not encoding, so sent as blank space
|
||||||
|
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318
|
||||||
|
*/
|
||||||
|
export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec {
|
||||||
|
encodeKey(k: string): string {
|
||||||
|
k = super.encodeKey(k);
|
||||||
|
return k.replace(/\+/gi, '%2B');
|
||||||
|
}
|
||||||
|
encodeValue(v: string): string {
|
||||||
|
v = super.encodeValue(v);
|
||||||
|
return v.replace(/\+/gi, '%2B');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id=""
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id=""
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note=""
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=`git remote`
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
export * from './api/api';
|
||||||
|
export * from './model/models';
|
||||||
|
export * from './variables';
|
||||||
|
export * from './configuration';
|
||||||
|
export * from './api.module';
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * from './restObject';
|
||||||
|
export * from './restProperty';
|
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* HPC Pack REST API 2016
|
||||||
|
* This is the API spec for Microsoft HPC Pack 2016 Update 3.
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 2016-11-01.5.3
|
||||||
|
* Contact: hpcpack@microsoft.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 { RestProperty } from './restProperty';
|
||||||
|
|
||||||
|
|
||||||
|
export interface RestObject {
|
||||||
|
properties?: Array<RestProperty>;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* HPC Pack REST API 2016
|
||||||
|
* This is the API spec for Microsoft HPC Pack 2016 Update 3.
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 2016-11-01.5.3
|
||||||
|
* Contact: hpcpack@microsoft.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 interface RestProperty {
|
||||||
|
name?: string;
|
||||||
|
value?: string;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { InjectionToken } from '@angular/core';
|
||||||
|
|
||||||
|
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||||
|
export const COLLECTION_FORMATS = {
|
||||||
|
'csv': ',',
|
||||||
|
'tsv': ' ',
|
||||||
|
'ssv': ' ',
|
||||||
|
'pipes': '|'
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче