removed unnecessary endpoints from fasten-api

documetnation for ligthouse.service
This commit is contained in:
Jason Kulatunga 2022-10-06 18:07:09 -07:00
parent 5b3aa03b7d
commit d9038f700c
2 changed files with 4 additions and 55 deletions

View File

@ -7,8 +7,6 @@ import {ResponseWrapper} from '../models/response-wrapper';
import {Source} from '../models/fasten/source';
import {User} from '../models/fasten/user';
import {ResourceFhir} from '../models/fasten/resource_fhir';
import {SourceSummary} from '../models/fasten/source-summary';
import {Summary} from '../models/fasten/summary';
import {MetadataSource} from '../models/fasten/metadata-source';
@Injectable({
@ -75,25 +73,6 @@ export class FastenApiService {
/*
SECURE ENDPOINTS
*/
getSummary(): Observable<Summary> {
return this._httpClient.get<any>(`${this.getBasePath()}/api/secure/summary`, )
.pipe(
map((response: ResponseWrapper) => {
console.log("Summary RESPONSE", response)
return response.data as Summary
})
);
}
createSource(source: Source): Observable<Source> {
return this._httpClient.post<any>(`${this.getBasePath()}/api/secure/source`, source)
.pipe(
map((response: ResponseWrapper) => {
console.log("SOURCE RESPONSE", response)
return response.data as Source
})
);
}
createManualSource(file: File): Observable<Source> {
@ -109,36 +88,6 @@ export class FastenApiService {
);
}
getSources(): Observable<Source[]> {
return this._httpClient.get<any>(`${this.getBasePath()}/api/secure/source`)
.pipe(
map((response: ResponseWrapper) => {
console.log("SOURCE RESPONSE", response)
return response.data as Source[]
})
);
}
getSource(sourceId: string): Observable<Source> {
return this._httpClient.get<any>(`${this.getBasePath()}/api/secure/source/${sourceId}`)
.pipe(
map((response: ResponseWrapper) => {
console.log("SOURCE RESPONSE", response)
return response.data as Source
})
);
}
getSourceSummary(sourceId: string): Observable<SourceSummary> {
return this._httpClient.get<any>(`${this.getBasePath()}/api/secure/source/${sourceId}/summary`)
.pipe(
map((response: ResponseWrapper) => {
console.log("SOURCE RESPONSE", response)
return response.data as SourceSummary
})
);
}
syncSource(sourceId: string): Observable<any> {
return this._httpClient.post<any>(`${this.getBasePath()}/api/secure/source/${sourceId}/sync`, {})
.pipe(

View File

@ -15,13 +15,13 @@ export class LighthouseService {
constructor(private _httpClient: HttpClient) {
}
getLighthouseSource(sourceType: string): Observable<LighthouseSourceMetadata> {
async getLighthouseSource(sourceType: string): Promise<LighthouseSourceMetadata> {
return this._httpClient.get<any>(`${environment.lighthouse_api_endpoint_base}/connect/${sourceType}`)
.pipe(
map((response: ResponseWrapper) => {
return response.data as LighthouseSourceMetadata
})
);
).toPromise();
}
@ -61,7 +61,7 @@ export class LighthouseService {
return authorizationUrl
}
redirectWithOriginAndDestination(destUrl: string, sourceType: string){
redirectWithOriginAndDestination(destUrl: string, sourceType: string): void {
const originUrlParts = new URL(window.location.href)
originUrlParts.hash = "" //reset hash in-case its present.
originUrlParts.pathname = this.pathJoin([originUrlParts.pathname, `callback/${sourceType}`])
@ -78,7 +78,7 @@ export class LighthouseService {
window.location.href = redirectUrlParts.toString();
}
async swapOauthToken(sourceType: string, sourceMetadata: LighthouseSourceMetadata, expectedState: string, state: string, code: string){
async swapOauthToken(sourceType: string, sourceMetadata: LighthouseSourceMetadata, expectedState: string, state: string, code: string): Promise<any>{
// @ts-expect-error
const client: oauth.Client = {
client_id: sourceMetadata.client_id