-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from rubenCodeforges/feature/client-config
Feature/client config
- Loading branch information
Showing
6 changed files
with
49 additions
and
30 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
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
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
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
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
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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
export interface GapiInitConfigs { | ||
clientId: string, | ||
discoveryDocs: string[], | ||
scope: string | ||
/** | ||
* @description https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2clientconfig | ||
*/ | ||
export interface ClientConfig { | ||
clientId: string; | ||
discoveryDocs: string[]; | ||
scope: string; | ||
ux_mode?: string; | ||
fetch_basic_profile?: boolean; | ||
cookie_policy?: string; | ||
hosted_domain?: string; | ||
redirect_uri?: string; | ||
} | ||
|
||
export class GoogleApiConfig { | ||
protected CLIENT_ID: string; | ||
protected DISCOVERY_DOCS: string[]; | ||
protected SCOPE: string; | ||
protected clientConfig: ClientConfig; | ||
|
||
constructor(configs: GapiInitConfigs) { | ||
this.CLIENT_ID = configs.clientId; | ||
this.DISCOVERY_DOCS = configs.discoveryDocs; | ||
this.SCOPE = configs.scope; | ||
constructor(clientConfig: ClientConfig) { | ||
this.clientConfig = clientConfig | ||
} | ||
|
||
public getConfigs(): GapiInitConfigs { | ||
return { | ||
clientId: this.CLIENT_ID, | ||
discoveryDocs: this.DISCOVERY_DOCS, | ||
scope: this.SCOPE | ||
} | ||
public getClientConfig(): ClientConfig { | ||
return this.clientConfig; | ||
} | ||
} |