@1uphealth-temp/api 中文文档教程

发布于 5年前 浏览 23 项目主页 更新于 3年前

@1uphealth/api

ApiSDK

APIURLBASE

类型:string

getUsers

GET /user-management/v1/user

获取存在于您的 1up 开发者应用程序中的所有用户的列表, 具有按特定用户过滤的选项

Parameters

  • oneUpUserId OneUpUserId?
  • appUserId AppUserId?

Returns Promise< /strong> 用户对象数组

createUser

POST /user-management/v1/user

将导致使用请求正文中传递的属性创建用户。 \ 如果用户已经存在,请求不会失败,而是会返回用户数据,但

Parameters

  • appUserId AppUserId
  • userActive UserActive

返回 Promise

updateUser

PUT /user-management/v1/user

可用于修改现有用户对象。 可以修改appuserid, 但是 oneupuserid 是在创建用户时分配的,不能更改。

Parameters

  • appUserId AppUserId
  • oneUpUserId OneUpUserId
  • userActive UserActive

返回 Promise将返回新用户object

generateUserAuthCode

POST /user-management/v1/user/auth-code

后端应用程序可以使用此端点为用户获取新的授权代码。 \ 请注意,不应在浏览器上下文中调用此端点,因为 \ 它需要向用户公开您应用程序的密钥。

Parameters

  • appUserId AppUserId

返回 Promise返回一个访问令牌和刷新令牌, 可用于验证代表用户发出的请求。

getHealthSystemPickerIFrame

GET /connect/marketplace

一种常见的模式是要求用户将数据从他们的健康系统连接到应用程序。 \ 此端点返回一个简单的 html 页面,可用作行走的起点 \ 用户通过数据连接流。 更多细节, \ 了解 https://1up.health/dev/doc/connect-health-data-iframe。

返回 Promise此端点返回一个 html页面和内联 css,在呈现时会生成 \ 选择用户想要连接的医疗保健系统。 最常用的\ 这是为了在开发人员自己的应用程序内的 iframe 中呈现此端点。

searchConnectProvider

GET /connect/system/provider

用于在健康系统上运行文本搜索,通常是为了允许用户 \ 找到他们健康系统的授权门户。

Parameters

  • query Query { query: string; } \ This is how you specify the text to search for. \ It can be a doctor's name, clinic, hospital, or address.

返回 Promise结果会返回一个包含 1upHealth \ 卫生系统 ID 和带有该组织或卫生系统徽标的扩展名。 \ 您可以使用它来将患者引导至正确的连接 api url,以便患者\ 可以授权共享他们的医疗数据。 \ 请参阅官方 hl7 FHIR 文档 (https://www.hl7.org/fhir/bundle.html)\ 有关 FHIR 包的结构的更多信息。

getDevices

GET /connect/system/device

目前,1upHealth 允许从 Fitbit、GoogleFit 或 Withings 导入数据。

返回 Promise返回设备列表可以用作源的类型。

getSupportedHealthSystems

GET /connect/system/clinical

使用此端点查询支持的健康系统的完整列表。 \ 如果您的用例将受益于对字段提供者的全文搜索 \ 如姓名、地址或临床医生姓名,那么我们建议 \ 而是使用提供者搜索端点。

返回 Promise

getFHIRResources

GET / fhir/{fhirVersion}/{resourceType}

返回资源类型的所有匹配 FHIR 资源 \ 也可以看看: \ 1upHealth 支持的 FHIR 版本和资源 https://1up.health/dev/reference/fhir-resources \ 官方 HL7 FHIR 文档 https://www.hl7.org/fhir

此端点以 http 承载身份验证标头的形式接收身份验证。

Parameters

  • fhirVersion FHIRVersion
  • resourceType (FHIRDSTU2.ResourceTypeStr | FHIRSTU3.ResourceTypeStr)
  • queryParams QueryParams

返回 Promise包含所有内容的 FHIR 包与查询匹配的资源,

createFHIRResource

POST /fhir/{fhirVersion}/{resourceType}

可用于创建具有给定类型的 FHIR 资源。 \ 也可以看看: \ 1upHealth 支持的 FHIR 版本和资源 https://1up.health/dev/reference/fhir-resources \ 官方 HL7 FHIR 文档 https://www.hl7.org/fhir

Parameters

  • fhirVersion FHIRVersion
  • resourceType (FHIRDSTU2.ResourceTypeStr | FHIRSTU3.ResourceTypeStr)
  • resource (FHIRDSTU2.Resource | FHIRSTU3.Resource)

返回 Promise包含已发布的所有属性的 FHIR 资源。

queryFHIREverything

GET /fhir/{fhirVersion}/Patient/{patientId}/$everything

此端点返回给定患者的所有已知 FHIR 资源的列表。 \ 这在传输批量数据或获取完整的患者病史时很有用。

Parameters

  • patientId PatientId
  • fhirVersion FHIRVersion

返回 Promise包含所有内容的 FHIR 包与查询匹配的资源

grantPermissions

PUT /fhir/dstu2/Patient/patientid/_permission/{oneUpUserId}

使用用户的 access_token 向 1upHealth FHIR API 发出请求时,\ 返回的资源将仅限于用户拥有的资源 \ 查看权限。 但是,有时在构建应用程序时您可能希望 \ 支持用户授予其他用户查看特定记录的权限。 \ 此端点允许您向任意用户授予对资源的访问权限。

Parameters

  • oneUpUserId OneUpUserId
  • fhirVersion FHIRVersion

返回 Promise

revokePermissions

DELETE / fhir/dstu2/Patient/patientid/_permission/{oneUpUserId}

此端点允许您删除已授予用户查看 \ 其他用户的 FHIR 资源。

Parameters

  • oneUpUserId OneUpUserId
  • fhirVersion FHIRVersion

返回 Promise

generateOAuth2Token

POST < a href="https://api.1up.health/fhir/oauth2/token">https://api.1up.health/fhir/oauth2/token

granttype=授权代码

此方法为给定的auth_code

Parameters

返回生成新的访问令牌Promise

refreshOAuth2Token

POST https://api.1up .health/fhir/oauth2/token

granttype=refreshtoken

此方法刷新给定 refresh_token 参数的访问令牌

Parameters

返回 Promise

authenticate

此方法生成访问令牌 对于 给定 appuserid。 \ 如果没有给定 appuser_id 的用户,它会创建一个新用户。

Parameters

  • appUserId AppUserId

返回 Promise

HttpClient

HttpClient 是帮助程序抽象请求库。

defaultOptions

类型:HttpClientOptions

get

Parameters

  • uri string
  • options HttpClientOptions?

返回 Promise

post

Parameters

  • uri string
  • options HttpClientOptions?

返回 < strong>Promise

patch

Parameters

  • uri string
  • options HttpClientOptions?

返回 Promise

put

Parameters

  • uri string
  • options HttpClientOptions?

返回 Promise

delete

Parameters

  • uri string
  • options HttpClientOptions?

返回 Promise

Validator

getUsersPayload

Parameters

  • oneUpUserId OneUpUserId?
  • appUserId AppUserId?

createUserPayload

Parameters

  • appUserId AppUserId
  • userActive UserActive

updateUserPayload

Parameters

  • appUserId AppUserId
  • oneUpUserId OneUpUserId
  • userActive UserActive

generateUserAuthCodePayload

Parameters

  • appUserId AppUserId

accessToken

Parameters

  • accessToken

clientKeys

Parameters

  • $0 Object
    • $0.clientId
    • $0.clientSecret

@1uphealth/api

ApiSDK

APIURLBASE

Type: string

getUsers

GET /user-management/v1/user

Get the list of all the users that exist inside your 1up Developer Application, with the option of filtering by specific users

Parameters

  • oneUpUserId OneUpUserId?
  • appUserId AppUserId?

Returns Promise<HttpClientResponse> An array of user objects

createUser

POST /user-management/v1/user

Will cause a user to be created with the attributes passed in the request body. \ The request won't fail if the user already exists but rather will return the user data but with

Parameters

  • appUserId AppUserId
  • userActive UserActive

Returns Promise<HttpClientResponse>

updateUser

PUT /user-management/v1/user

Can be used to modify an existing user object. It is possible to modify the appuserid, but the oneupuserid is assigned when the user is created and cannot be changed.

Parameters

  • appUserId AppUserId
  • oneUpUserId OneUpUserId
  • userActive UserActive

Returns Promise<HttpClientResponse> Will return the new user object

generateUserAuthCode

POST /user-management/v1/user/auth-code

A backend app can use this endpoint to get a new authorization code for a user. \ Note that this endpoint should not be called in a browser context because \ it would require exposing your app's secret key to users.

Parameters

  • appUserId AppUserId

Returns Promise<HttpClientResponse> Returns an access token and a refresh token, which can be used to authenticate requests made on behalf of the user.

getHealthSystemPickerIFrame

GET /connect/marketplace

A common pattern is to ask the user to connect data from their health system to the app. \ This endpoint returns a simple html page that can be used as a starting point for walking \ the user through the data connect flow. For more details, \ read about the https://1up.health/dev/doc/connect-health-data-iframe.

Returns Promise<HttpClientResponse> This endpoint returns an html page and inline css that, when rendered, results in a UI for \ selecting which health care system the user would like to connect. The most common use of \ this is to render this endpoint in an iframe within the developers own app.

searchConnectProvider

GET /connect/system/provider

Used to run a text search on health systems, often for the purpose of allowing the user \ to find their health system's authorization portal.

Parameters

  • query Query { query: string; } \ This is how you specify the text to search for. \ It can be a doctor's name, clinic, hospital, or address.

Returns Promise<HttpClientResponse> The result will return a bundle of FHIR Organizations which contain the 1upHealth \ health system id and an extension with the logo of that org or health system. \ You can use that to direct the patient to the correct connect api url so the patient \ can authorize sharing of their medical data. \ See the official hl7 FHIR docs (https://www.hl7.org/fhir/bundle.html) \ for more information on how a FHIR bundle is structured.

getDevices

GET /connect/system/device

Currently 1upHealth allows importing data from either Fitbit, GoogleFit or Withings.

Returns Promise<HttpClientResponse> Returns a list of device types that can be used as sources.

getSupportedHealthSystems

GET /connect/system/clinical

Use this endpoint to query the full list of supported health systems. \ If your use-case would benefit from full-text search of providers on fields \ like name, address, or clinician names, then we recommend \ using the Provider Search endpoint instead.

Returns Promise<HttpClientResponse>

getFHIRResources

GET /fhir/{fhirVersion}/{resourceType}

Returns all matching FHIR resources for a resource type \ See also: \ FHIR versions and resources supported by 1upHealth https://1up.health/dev/reference/fhir-resources \ The official HL7 FHIR docs https://www.hl7.org/fhir

This endpoint receives authentication in the form of a http bearer authenitcation header.

Parameters

  • fhirVersion FHIRVersion
  • resourceType (FHIRDSTU2.ResourceTypeStr | FHIRSTU3.ResourceTypeStr)
  • queryParams QueryParams

Returns Promise<HttpClientResponse> A FHIR Bundle containing all the resources that match the query,

createFHIRResource

POST /fhir/{fhirVersion}/{resourceType}

Can be used to create a FHIR resource with a given type. \ See also: \ FHIR versions and resources supported by 1upHealth https://1up.health/dev/reference/fhir-resources \ The official HL7 FHIR docs https://www.hl7.org/fhir

Parameters

  • fhirVersion FHIRVersion
  • resourceType (FHIRDSTU2.ResourceTypeStr | FHIRSTU3.ResourceTypeStr)
  • resource (FHIRDSTU2.Resource | FHIRSTU3.Resource)

Returns Promise<HttpClientResponse> A FHIR Resource containing all the attributes that were posted.

queryFHIREverything

GET /fhir/{fhirVersion}/Patient/{patientId}/$everything

This endpoint returns a list of all known FHIR resources for a given patient. \ This is useful when transmitting batch data or getting the full patient history.

Parameters

  • patientId PatientId
  • fhirVersion FHIRVersion

Returns Promise<HttpClientResponse> A FHIR Bundle containing all the resources that match the query

grantPermissions

PUT /fhir/dstu2/Patient/patientid/_permission/{oneUpUserId}

When making a request to the 1upHealth FHIR API using a user's access_token, \ the resources returned will be scoped to only the resources that the user has \ permissions to view. However, sometimes when building an app you might want to \ support the ability for users to grant access to other users to see certain records. \ This endpoint allows you to grant access to resources to arbitrary users.

Parameters

  • oneUpUserId OneUpUserId
  • fhirVersion FHIRVersion

Returns Promise<HttpClientResponse>

revokePermissions

DELETE /fhir/dstu2/Patient/patientid/_permission/{oneUpUserId}

This endpoint allows you to remove permissions that have been granted to users to see \ other users' FHIR resources.

Parameters

  • oneUpUserId OneUpUserId
  • fhirVersion FHIRVersion

Returns Promise<HttpClientResponse>

generateOAuth2Token

POST https://api.1up.health/fhir/oauth2/token

granttype=authorizationcode

This method generates new access token for given auth_code

Parameters

Returns Promise<HttpClientResponse>

refreshOAuth2Token

POST https://api.1up.health/fhir/oauth2/token

granttype=refreshtoken

This method refresh access token for given refresh_token parameter

Parameters

Returns Promise<HttpClientResponse>

authenticate

This method generate accesstoken for given appuserid. \ If there is no user with given appuser_id, it creates new one.

Parameters

  • appUserId AppUserId

Returns Promise<HttpClientResponse>

HttpClient

HttpClient is helper abstraction over the request library.

defaultOptions

Type: HttpClientOptions

get

Parameters

  • uri string
  • options HttpClientOptions?

Returns Promise<HttpClientResponse>

post

Parameters

  • uri string
  • options HttpClientOptions?

Returns Promise<HttpClientResponse>

patch

Parameters

  • uri string
  • options HttpClientOptions?

Returns Promise<HttpClientResponse>

put

Parameters

  • uri string
  • options HttpClientOptions?

Returns Promise<HttpClientResponse>

delete

Parameters

  • uri string
  • options HttpClientOptions?

Returns Promise<HttpClientResponse>

Validator

getUsersPayload

Parameters

  • oneUpUserId OneUpUserId?
  • appUserId AppUserId?

createUserPayload

Parameters

  • appUserId AppUserId
  • userActive UserActive

updateUserPayload

Parameters

  • appUserId AppUserId
  • oneUpUserId OneUpUserId
  • userActive UserActive

generateUserAuthCodePayload

Parameters

  • appUserId AppUserId

accessToken

Parameters

  • accessToken

clientKeys

Parameters

  • $0 Object
    • $0.clientId
    • $0.clientSecret
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文