-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
438ea60
commit b7b6075
Showing
5 changed files
with
327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="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="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="Minor update" | ||
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' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
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/company+json | ||
* TODO: Add application/edi+ support | ||
* TODO: See Clubhouse | ||
* @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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
/* tslint:disable:no-unused-variable member-ordering */ | ||
|
||
import { Inject, Injectable, Optional } from '@angular/core'; | ||
// import { HttpClient, HttpHeaders, HttpParams, | ||
// HttpResponse, HttpEvent } from '@angular/common/http'; | ||
import { CustomHttpUrlEncodingCodec } from '/encoder'; | ||
|
||
import { Observable } from 'rxjs'; | ||
|
||
import { BillOfLadingNumber } from './ts/billOfLadingNumber'; | ||
import { BookingReference } from './ts/bookingReference'; | ||
import { EquipmentReference } from './ts/equipmentReference'; | ||
import { EventTypeList } from './ts/eventTypeList'; | ||
import { Events } from './ts/events'; | ||
import { InlineResponse200 } from './ts/inlineResponse200'; | ||
|
||
import { BASE_PATH, COLLECTION_FORMATS } from '/variables'; | ||
import { Configuration } from '/configuration'; | ||
|
||
|
||
@Injectable() | ||
export class EventsService { | ||
|
||
// protected basePath = 'https://services.freighttrust.com/base'; | ||
// public defaultHeaders = new HttpHeaders(); | ||
public configuration = new Configuration(); | ||
/* | ||
// constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { | ||
if (basePath) { | ||
this.basePath = basePath; | ||
} | ||
if (configuration) { | ||
this.configuration = configuration; | ||
this.basePath = basePath || configuration.basePath || this.basePath; | ||
} | ||
} | ||
/** | ||
* @param consumes string[] mime-types | ||
* @return true: consumes contains 'multipart/form-data', false: otherwise | ||
*/ | ||
private canConsumeForm(consumes: string[]): boolean { | ||
const form = 'multipart/form-data'; | ||
for (const consume of consumes) { | ||
if (form === consume) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
|
||
/** | ||
* Find events by eventID. | ||
* Returns event with the specified eventID. | ||
* @param eventID The ID of the event to receive | ||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | ||
* @param reportProgress flag to report request and response progress. | ||
*/ | ||
public eventsEventIDGet(eventID: string, observe?: 'body', reportProgress?: boolean): Observable<InlineResponse200>; | ||
public eventsEventIDGet(eventID: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<InlineResponse200>>; | ||
public eventsEventIDGet(eventID: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<InlineResponse200>>; | ||
public eventsEventIDGet(eventID: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { | ||
|
||
if (eventID === null || eventID === undefined) { | ||
throw new Error('Required parameter eventID was null or undefined when calling eventsEventIDGet.'); | ||
} | ||
|
||
// let headers = this.defaultHeaders; | ||
|
||
// to determine the Accept header | ||
let httpHeaderAccepts: string[] = [ | ||
'application/json' | ||
]; | ||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); | ||
if (httpHeaderAcceptSelected != undefined) { | ||
// headers = headers.set('Accept', httpHeaderAcceptSelected); | ||
} | ||
|
||
// to determine the Content-Type header | ||
const consumes: string[] = [ | ||
]; | ||
/** | ||
return this.httpClient.request<InlineResponse200>('get',`${this.basePath}/events/${encodeURIComponent(String(eventID))}`, | ||
{ | ||
withCredentials: this.configuration.withCredentials, | ||
headers: headers, | ||
observe: observe, | ||
reportProgress: reportProgress | ||
} | ||
); | ||
} | ||
/** | ||
* Find events by type, Booking Reference, Bill of Lading or Equipment Reference. | ||
* Returns all events filtered by the parameters. | ||
* @param eventType The type of event(s) to filter by. | ||
* @param bookingReference The identifier for a shipment, which is issued by and unique within each of the carriers. | ||
* @param billOfLadingNumber Bill of lading number is an identifier that links to a shipment. Bill of Lading is the legal document issued to the customer, which confirms the carrier's receipt of the cargo from the customer acknowledging goods being shipped and specifying the terms of delivery. | ||
* @param equipmentReference The unique identifier for the equipment, which should follow the BIC ISO Container Identification Number where possible. | ||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | ||
* @param reportProgress flag to report request and response progress. | ||
*/ | ||
// public eventsGet(eventType?: EventTypeList, bookingReference?: BookingReference, billOfLadingNumber?: BillOfLadingNumber, equipmentReference?: EquipmentReference, observe?: 'body', reportProgress?: boolean): Observable<Events>; | ||
// public eventsGet(eventType?: EventTypeList, bookingReference?: BookingReference, billOfLadingNumber?: BillOfLadingNumber, equipmentReference?: EquipmentReference, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Events>>; | ||
// public eventsGet(eventType?: EventTypeList, bookingReference?: BookingReference, billOfLadingNumber?: BillOfLadingNumber, equipmentReference?: EquipmentReference, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Events>>; | ||
// public eventsGet(eventType?: EventTypeList, bookingReference?: BookingReference, billOfLadingNumber?: BillOfLadingNumber, equipmentReference?: EquipmentReference, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { | ||
|
||
|
||
|
||
|
||
/* | ||
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); | ||
if (eventType !== undefined && eventType !== null) { | ||
queryParameters = queryParameters.set('eventType', <any>eventType); | ||
} | ||
if (bookingReference !== undefined && bookingReference !== null) { | ||
queryParameters = queryParameters.set('bookingReference', <any>bookingReference); | ||
} | ||
if (billOfLadingNumber !== undefined && billOfLadingNumber !== null) { | ||
queryParameters = queryParameters.set('billOfLadingNumber', <any>billOfLadingNumber); | ||
} | ||
if (equipmentReference !== undefined && equipmentReference !== null) { | ||
queryParameters = queryParameters.set('equipmentReference', <any>equipmentReference); | ||
} | ||
let headers = this.defaultHeaders; | ||
// to determine the Accept header | ||
let httpHeaderAccepts: string[] = [ | ||
'application/json' | ||
]; | ||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); | ||
if (httpHeaderAcceptSelected != undefined) { | ||
headers = headers.set('Accept', httpHeaderAcceptSelected); | ||
} | ||
// to determine the Content-Type header | ||
const consumes: string[] = [ | ||
]; | ||
return this.httpClient.request<Events>('get',`${this.basePath}/events`, | ||
{ | ||
params: queryParameters, | ||
withCredentials: this.configuration.withCredentials, | ||
headers: headers, | ||
observe: observe, | ||
reportProgress: reportProgress | ||
} | ||
); | ||
} | ||
} | ||
*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; | ||
import { Configuration } from './configuration'; | ||
// import { HttpClient } from 'your module'; | ||
|
||
|
||
import { EventsService } from './events.service'; | ||
import { SubscriptionsService } from './subscriptions.service'; | ||
|
||
@NgModule({ | ||
imports: [], | ||
declarations: [], | ||
exports: [], | ||
providers: [ | ||
EventsService, | ||
SubscriptionsService ] | ||
}) | ||
export class FreightModule { | ||
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { | ||
return { | ||
Module: FreightModule, | ||
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'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './ts'; | ||
export * from './variables'; | ||
export * from './configuration'; |