-
Notifications
You must be signed in to change notification settings - Fork 78
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
add europe ccs2 request #283
Open
arteck
wants to merge
3
commits into
Hacksore:master
Choose a base branch
from
arteck:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
node_modules/ | ||
.DS_Store | ||
.rpt2_cache | ||
dist/ | ||
config*.json | ||
.vs/ | ||
.vscode/ | ||
coverage/ | ||
dist/ |
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,24 @@ | ||
import { CanadianBrandEnvironment } from './constants/canada'; | ||
import { EuropeanBrandEnvironment } from './constants/europe'; | ||
import { ChineseBrandEnvironment } from './constants/china'; | ||
import { AustraliaBrandEnvironment } from './constants/australia'; | ||
import { Brand, VehicleStatusOptions } from './interfaces/common.interfaces'; | ||
export declare const ALL_ENDPOINTS: { | ||
CA: (brand: Brand) => CanadianBrandEnvironment['endpoints']; | ||
EU: (brand: Brand) => EuropeanBrandEnvironment['endpoints']; | ||
CN: (brand: Brand) => ChineseBrandEnvironment['endpoints']; | ||
AU: (brand: Brand) => AustraliaBrandEnvironment['endpoints']; | ||
}; | ||
export declare const GEN2 = 2; | ||
export declare const GEN1 = 1; | ||
export type REGION = 'US' | 'CA' | 'EU' | 'CN' | 'AU'; | ||
export declare enum REGIONS { | ||
US = "US", | ||
CA = "CA", | ||
EU = "EU", | ||
CN = "CN", | ||
AU = "AU" | ||
} | ||
export type ChargeTarget = 50 | 60 | 70 | 80 | 90 | 100; | ||
export declare const POSSIBLE_CHARGE_LIMIT_VALUES: number[]; | ||
export declare const DEFAULT_VEHICLE_STATUS_OPTIONS: VehicleStatusOptions; |
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,9 @@ | ||
import { Brand } from '../interfaces/common.interfaces'; | ||
export interface AmericaBrandEnvironment { | ||
brand: Brand; | ||
host: string; | ||
baseUrl: string; | ||
clientId: string; | ||
clientSecret: string; | ||
} | ||
export declare const getBrandEnvironment: (brand: Brand) => AmericaBrandEnvironment; |
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 @@ | ||
/// <reference types="node" /> | ||
export declare const kiaCFB: Buffer; | ||
export declare const hyundaiCFB: Buffer; |
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,28 @@ | ||
import { AustraliaBlueLinkyConfig } from '../controllers/australia.controller'; | ||
import { Brand } from '../interfaces/common.interfaces'; | ||
import { StampMode } from './stamps'; | ||
export interface AustraliaBrandEnvironment { | ||
brand: Brand; | ||
host: string; | ||
baseUrl: string; | ||
clientId: string; | ||
appId: string; | ||
endpoints: { | ||
integration: string; | ||
silentSignIn: string; | ||
session: string; | ||
login: string; | ||
language: string; | ||
redirectUri: string; | ||
token: string; | ||
}; | ||
basicToken: string; | ||
stamp: () => Promise<string>; | ||
} | ||
type EnvironmentConfig = { | ||
stampMode: StampMode; | ||
stampsFile?: string; | ||
}; | ||
type BrandEnvironmentConfig = Pick<AustraliaBlueLinkyConfig, 'brand'> & Partial<EnvironmentConfig>; | ||
export declare const getBrandEnvironment: ({ brand, stampMode, stampsFile, }: BrandEnvironmentConfig) => AustraliaBrandEnvironment; | ||
export {}; |
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,28 @@ | ||
import { Brand } from '../interfaces/common.interfaces'; | ||
export interface CanadianBrandEnvironment { | ||
brand: Brand; | ||
host: string; | ||
baseUrl: string; | ||
origin: 'SPA'; | ||
endpoints: { | ||
login: string; | ||
logout: string; | ||
vehicleList: string; | ||
vehicleInfo: string; | ||
status: string; | ||
remoteStatus: string; | ||
lock: string; | ||
unlock: string; | ||
start: string; | ||
stop: string; | ||
locate: string; | ||
hornlight: string; | ||
verifyAccountToken: string; | ||
verifyPin: string; | ||
verifyToken: string; | ||
setChargeTarget: string; | ||
stopCharge: string; | ||
startCharge: string; | ||
}; | ||
} | ||
export declare const getBrandEnvironment: (brand: Brand) => CanadianBrandEnvironment; |
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,25 @@ | ||
import { ChineseBlueLinkConfig } from '../controllers/chinese.controller'; | ||
import { Brand } from '../interfaces/common.interfaces'; | ||
export interface ChineseBrandEnvironment { | ||
brand: Brand; | ||
host: string; | ||
baseUrl: string; | ||
clientId: string; | ||
appId: string; | ||
endpoints: { | ||
integration: string; | ||
silentSignIn: string; | ||
session: string; | ||
login: string; | ||
language: string; | ||
redirectUri: string; | ||
token: string; | ||
}; | ||
basicToken: string; | ||
GCMSenderID: string; | ||
providerDeviceId: string; | ||
pushRegId: string; | ||
} | ||
type BrandEnvironmentConfig = Pick<ChineseBlueLinkConfig, 'brand'>; | ||
export declare const getBrandEnvironment: ({ brand, }: BrandEnvironmentConfig) => ChineseBrandEnvironment; | ||
export {}; |
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 @@ | ||
/// <reference types="node" /> | ||
export declare const kiaCFB: Buffer; | ||
export declare const hyundaiCFB: Buffer; |
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,33 @@ | ||
import { EuropeBlueLinkyConfig } from '../controllers/european.controller'; | ||
import { Brand } from '../interfaces/common.interfaces'; | ||
export type EULanguages = 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'it' | 'pl' | 'hu' | 'no' | 'sk' | 'es' | 'sv'; | ||
export declare const EU_LANGUAGES: EULanguages[]; | ||
export declare const DEFAULT_LANGUAGE: EULanguages; | ||
export interface EuropeanBrandEnvironment { | ||
brand: Brand; | ||
host: string; | ||
baseUrl: string; | ||
clientId: string; | ||
appId: string; | ||
endpoints: { | ||
integration: string; | ||
silentSignIn: string; | ||
session: string; | ||
login: string; | ||
language: string; | ||
redirectUri: string; | ||
token: string; | ||
}; | ||
basicToken: string; | ||
GCMSenderID: string; | ||
stamp: () => Promise<string>; | ||
brandAuthUrl: (options: { | ||
language: EULanguages; | ||
serviceId: string; | ||
userId: string; | ||
}) => string; | ||
} | ||
type EnvironmentConfig = Required<Pick<EuropeBlueLinkyConfig, 'stampMode'>> & Partial<Pick<EuropeBlueLinkyConfig, 'stampsFile'>>; | ||
type BrandEnvironmentConfig = Pick<EuropeBlueLinkyConfig, 'brand'> & Partial<EnvironmentConfig>; | ||
export declare const getBrandEnvironment: ({ brand, stampMode, stampsFile, }: BrandEnvironmentConfig) => EuropeanBrandEnvironment; | ||
export {}; |
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,16 @@ | ||
import { Brand } from '../interfaces/common.interfaces'; | ||
import { REGIONS } from '../constants'; | ||
export declare enum StampMode { | ||
LOCAL = "LOCAL", | ||
DISTANT = "DISTANT" | ||
} | ||
export declare const getStampFromFile: (stampFileKey: string, stampHost: string, stampsFile?: string) => () => Promise<string>; | ||
export declare const getStampFromCFB: (appId: string, brand: Brand, region: REGIONS) => (() => Promise<string>); | ||
export declare const getStampGenerator: ({ appId, brand, mode, region, stampHost, stampsFile, }: { | ||
appId: string; | ||
brand: Brand; | ||
mode: StampMode; | ||
region: REGIONS; | ||
stampHost: string; | ||
stampsFile?: string | undefined; | ||
}) => (() => Promise<string>); |
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,17 @@ | ||
import { BlueLinkyConfig } from './../interfaces/common.interfaces'; | ||
import { Vehicle } from '../vehicles/vehicle'; | ||
import { SessionController } from './controller'; | ||
import { AmericaBrandEnvironment } from '../constants/america'; | ||
export interface AmericanBlueLinkyConfig extends BlueLinkyConfig { | ||
region: 'US'; | ||
} | ||
export declare class AmericanController extends SessionController<AmericanBlueLinkyConfig> { | ||
private _environment; | ||
constructor(userConfig: AmericanBlueLinkyConfig); | ||
get environment(): AmericaBrandEnvironment; | ||
private vehicles; | ||
refreshAccessToken(): Promise<string>; | ||
login(): Promise<string>; | ||
logout(): Promise<string>; | ||
getVehicles(): Promise<Array<Vehicle>>; | ||
} |
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,28 @@ | ||
import { GotInstance, GotJSONFn } from 'got'; | ||
import { Vehicle } from '../vehicles/vehicle'; | ||
import { AustraliaBrandEnvironment } from './../constants/australia'; | ||
import { BlueLinkyConfig, Session } from './../interfaces/common.interfaces'; | ||
import { SessionController } from './controller'; | ||
import { StampMode } from '../constants/stamps'; | ||
export interface AustraliaBlueLinkyConfig extends BlueLinkyConfig { | ||
region: 'AU'; | ||
stampMode?: StampMode; | ||
stampsFile?: string; | ||
} | ||
export declare class AustraliaController extends SessionController<AustraliaBlueLinkyConfig> { | ||
private _environment; | ||
private authStrategy; | ||
constructor(userConfig: AustraliaBlueLinkyConfig); | ||
get environment(): AustraliaBrandEnvironment; | ||
session: Session; | ||
private vehicles; | ||
refreshAccessToken(): Promise<string>; | ||
enterPin(): Promise<string>; | ||
login(): Promise<string>; | ||
logout(): Promise<string>; | ||
getVehicles(): Promise<Array<Vehicle>>; | ||
private checkControlToken; | ||
getVehicleHttpService(): Promise<GotInstance<GotJSONFn>>; | ||
getApiHttpService(): Promise<GotInstance<GotJSONFn>>; | ||
private get defaultHeaders(); | ||
} |
17 changes: 17 additions & 0 deletions
17
dist/controllers/authStrategies/australia.authStrategy.d.ts
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,17 @@ | ||
import { CookieJar } from 'tough-cookie'; | ||
import { AuthStrategy, Code } from './authStrategy'; | ||
import { AustraliaBrandEnvironment } from '../../constants/australia'; | ||
export declare class AustraliaAuthStrategy implements AuthStrategy { | ||
private readonly environment; | ||
constructor(environment: AustraliaBrandEnvironment); | ||
get name(): string; | ||
login(user: { | ||
username: string; | ||
password: string; | ||
}, options?: { | ||
cookieJar: CookieJar; | ||
}): Promise<{ | ||
code: Code; | ||
cookies: CookieJar; | ||
}>; | ||
} |
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,16 @@ | ||
import { CookieJar } from 'tough-cookie'; | ||
import { EULanguages, EuropeanBrandEnvironment } from '../../constants/europe'; | ||
export type Code = string; | ||
export interface AuthStrategy { | ||
readonly name: string; | ||
login(user: { | ||
username: string; | ||
password: string; | ||
}, options?: { | ||
cookieJar?: CookieJar; | ||
}): Promise<{ | ||
code: Code; | ||
cookies: CookieJar; | ||
}>; | ||
} | ||
export declare function initSession(environment: EuropeanBrandEnvironment, language?: EULanguages, cookies?: CookieJar): Promise<CookieJar>; |
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,16 @@ | ||
import { CookieJar } from 'tough-cookie'; | ||
import { ChineseBrandEnvironment } from '../../constants/china'; | ||
export type Code = string; | ||
export interface AuthStrategy { | ||
readonly name: string; | ||
login(user: { | ||
username: string; | ||
password: string; | ||
}, options?: { | ||
cookieJar?: CookieJar; | ||
}): Promise<{ | ||
code: Code; | ||
cookies: CookieJar; | ||
}>; | ||
} | ||
export declare function initSession(environment: ChineseBrandEnvironment, cookies?: CookieJar): Promise<CookieJar>; |
17 changes: 17 additions & 0 deletions
17
dist/controllers/authStrategies/chinese.legacyAuth.strategy.d.ts
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,17 @@ | ||
import { CookieJar } from 'tough-cookie'; | ||
import { ChineseBrandEnvironment } from '../../constants/china'; | ||
import { AuthStrategy, Code } from './china.authStrategy'; | ||
export declare class ChineseLegacyAuthStrategy implements AuthStrategy { | ||
private readonly environment; | ||
constructor(environment: ChineseBrandEnvironment); | ||
get name(): string; | ||
login(user: { | ||
username: string; | ||
password: string; | ||
}, options?: { | ||
cookieJar: CookieJar; | ||
}): Promise<{ | ||
code: Code; | ||
cookies: CookieJar; | ||
}>; | ||
} |
18 changes: 18 additions & 0 deletions
18
dist/controllers/authStrategies/european.brandAuth.strategy.d.ts
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,18 @@ | ||
import { CookieJar } from 'tough-cookie'; | ||
import { EULanguages, EuropeanBrandEnvironment } from '../../constants/europe'; | ||
import { AuthStrategy, Code } from './authStrategy'; | ||
export declare class EuropeanBrandAuthStrategy implements AuthStrategy { | ||
private readonly environment; | ||
private readonly language; | ||
constructor(environment: EuropeanBrandEnvironment, language: EULanguages); | ||
get name(): string; | ||
login(user: { | ||
username: string; | ||
password: string; | ||
}, options?: { | ||
cookieJar?: CookieJar; | ||
}): Promise<{ | ||
code: Code; | ||
cookies: CookieJar; | ||
}>; | ||
} |
18 changes: 18 additions & 0 deletions
18
dist/controllers/authStrategies/european.legacyAuth.strategy.d.ts
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,18 @@ | ||
import { CookieJar } from 'tough-cookie'; | ||
import { EULanguages, EuropeanBrandEnvironment } from '../../constants/europe'; | ||
import { AuthStrategy, Code } from './authStrategy'; | ||
export declare class EuropeanLegacyAuthStrategy implements AuthStrategy { | ||
private readonly environment; | ||
private readonly language; | ||
constructor(environment: EuropeanBrandEnvironment, language: EULanguages); | ||
get name(): string; | ||
login(user: { | ||
username: string; | ||
password: string; | ||
}, options?: { | ||
cookieJar: CookieJar; | ||
}): Promise<{ | ||
code: Code; | ||
cookies: CookieJar; | ||
}>; | ||
} |
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,19 @@ | ||
import { BlueLinkyConfig } from '../interfaces/common.interfaces'; | ||
import { CanadianBrandEnvironment } from '../constants/canada'; | ||
import { Vehicle } from '../vehicles/vehicle'; | ||
import { SessionController } from './controller'; | ||
export interface CanadianBlueLinkyConfig extends BlueLinkyConfig { | ||
region: 'CA'; | ||
} | ||
export declare class CanadianController extends SessionController<CanadianBlueLinkyConfig> { | ||
private _environment; | ||
constructor(userConfig: CanadianBlueLinkyConfig); | ||
get environment(): CanadianBrandEnvironment; | ||
private vehicles; | ||
private timeOffset; | ||
refreshAccessToken(): Promise<string>; | ||
login(): Promise<string>; | ||
logout(): Promise<string>; | ||
getVehicles(): Promise<Array<Vehicle>>; | ||
private request; | ||
} |
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,26 @@ | ||
import { ChineseBrandEnvironment } from '../constants/china'; | ||
import { BlueLinkyConfig, Session } from '../interfaces/common.interfaces'; | ||
import { GotInstance, GotJSONFn } from 'got'; | ||
import { Vehicle } from '../vehicles/vehicle'; | ||
import { SessionController } from './controller'; | ||
export interface ChineseBlueLinkConfig extends BlueLinkyConfig { | ||
region: 'CN'; | ||
} | ||
export declare class ChineseController extends SessionController<ChineseBlueLinkConfig> { | ||
private _environment; | ||
private authStrategies; | ||
constructor(userConfig: ChineseBlueLinkConfig); | ||
get environment(): ChineseBrandEnvironment; | ||
ß: any; | ||
session: Session; | ||
private vehicles; | ||
refreshAccessToken(): Promise<string>; | ||
enterPin(): Promise<string>; | ||
login(): Promise<string>; | ||
logout(): Promise<string>; | ||
getVehicles(): Promise<Array<Vehicle>>; | ||
private checkControlToken; | ||
getVehicleHttpService(): Promise<GotInstance<GotJSONFn>>; | ||
getApiHttpService(): Promise<GotInstance<GotJSONFn>>; | ||
private get defaultHeaders(); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert this