- Preparing search index...
- The search index is not available
terra-api
Constructors
constructor
- new Terra(devID: string, apiKey: string, secret: string): Terra
-
Parameters
-
devID: string
-
apiKey: string
-
secret: string
Properties
Private
apiKey
apiKey: string
Private
devID
devID: string
getActivity
get
Activity
: ((params
: { endDate
?: Date; retryIfRateLimited
?: boolean; startDate
: Date; toWebhook
?: boolean; userId
: string; withSamples
?: boolean }) => Promise<TerraDataResponse<Activity>>) = ...
Type declaration
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<Activity>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
getBody
get
Body
: ((params
: { endDate
?: Date; retryIfRateLimited
?: boolean; startDate
: Date; toWebhook
?: boolean; userId
: string; withSamples
?: boolean }) => Promise<TerraDataResponse<Body>>) = ...
Type declaration
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<Body>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
getDaily
get
Daily
: ((params
: { endDate
?: Date; retryIfRateLimited
?: boolean; startDate
: Date; toWebhook
?: boolean; userId
: string; withSamples
?: boolean }) => Promise<TerraDataResponse<Daily>>) = ...
Type declaration
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<Daily>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
getMenstruation
get
Menstruation
: ((params
: { endDate
?: Date; retryIfRateLimited
?: boolean; startDate
: Date; toWebhook
?: boolean; userId
: string; withSamples
?: boolean }) => Promise<TerraDataResponse<Menstruation>>) = ...
Type declaration
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<Menstruation>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
getNutrition
get
Nutrition
: ((params
: { endDate
?: Date; retryIfRateLimited
?: boolean; startDate
: Date; toWebhook
?: boolean; userId
: string; withSamples
?: boolean }) => Promise<TerraDataResponse<Nutrition>>) = ...
Type declaration
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<Nutrition>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
getSleep
get
Sleep
: ((params
: { endDate
?: Date; retryIfRateLimited
?: boolean; startDate
: Date; toWebhook
?: boolean; userId
: string; withSamples
?: boolean }) => Promise<TerraDataResponse<Sleep>>) = ...
Type declaration
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<Sleep>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
Private
mutex
mutex: Mutex = ...
Private
secret
secret: string
Methods
authUser
- authUser(params: { authFailureRedirectUrl?: string; authSuccessRedirectUrl?: string; facilityId?: string; language?: string; referenceId?: string; resource: string }): Promise<TerraAuthUserResponse>
-
Parameters
-
params: { authFailureRedirectUrl?: string; authSuccessRedirectUrl?: string; facilityId?: string; language?: string; referenceId?: string; resource: string }
-
Optional
authFailureRedirectUrl?: string
-
Optional
authSuccessRedirectUrl?: string
-
Optional
facilityId?: string
-
Optional
language?: string
-
Optional
referenceId?: string
-
resource: string
checkTerraSignature
- checkTerraSignature(terraSignature: string, payload: string): boolean
-
Parameters
-
terraSignature: string
-
payload: string
Returns boolean
deauthUser
- deauthUser(userID: string): Promise<void>
-
Returns Promise<void>
executeSynchronously
- executeSynchronously(callback: ((...args: any[]) => void), ...args: any[]): void
-
Parameters
-
callback: ((...args: any[]) => void)
-
- (...args: any[]): void
-
Returns void
-
Rest
...args: any[]
Returns void
generateWidgetSession
- generateWidgetSession(params: { authFailureRedirectUrl?: string; authSuccessRedirectUrl?: string; language: string; providers?: string[]; referenceID: string; showDisconnect?: boolean }): Promise<TerraWidgetResponse>
-
Parameters
-
params: { authFailureRedirectUrl?: string; authSuccessRedirectUrl?: string; language: string; providers?: string[]; referenceID: string; showDisconnect?: boolean }
-
Optional
authFailureRedirectUrl?: string
-
Optional
authSuccessRedirectUrl?: string
-
language: string
-
Optional
providers?: string[]
-
referenceID: string
-
Optional
showDisconnect?: boolean
getAthlete
- getAthlete(params: { toWebhook?: boolean; userId: string }): Promise<TerraAthleteResponse>
-
Parameters
-
params: { toWebhook?: boolean; userId: string }
-
Optional
toWebhook?: boolean
-
userId: string
Private
getDataWrapper
- getDataWrapper<T>(type: dataType): ((params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }) => Promise<TerraDataResponse<T>>)
-
Returns ((params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }) => Promise<TerraDataResponse<T>>)
-
- (params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }): Promise<TerraDataResponse<T>>
-
Parameters
-
params: { endDate?: Date; retryIfRateLimited?: boolean; startDate: Date; toWebhook?: boolean; userId: string; withSamples?: boolean }
-
Optional
endDate?: Date
-
Optional
retryIfRateLimited?: boolean
-
startDate: Date
-
Optional
toWebhook?: boolean
-
userId: string
-
Optional
withSamples?: boolean
getUser
- getUser(params: { referenceID?: string; userID?: string }): Promise<TerraUserResponse>
-
Parameters
-
params: { referenceID?: string; userID?: string }
-
Optional
referenceID?: string
-
Optional
userID?: string
patchUser
- patchUser(userId: string, referenceId: null | string, setActive: boolean): Promise<TerraUser>
-
Parameters
-
userId: string
-
referenceId: null | string
-
setActive: boolean
Get Activity data for current user
Returns
A promise of type Activity Data