feat: add responses package
This commit is contained in:
11
packages/responses/src/Domain/Auth/ChangeCredentialsData.ts
Normal file
11
packages/responses/src/Domain/Auth/ChangeCredentialsData.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { AnyKeyParamsContent } from '@standardnotes/common'
|
||||
import { SessionBody } from './SessionBody'
|
||||
import { User } from './User'
|
||||
|
||||
export type ChangeCredentialsData = {
|
||||
session?: SessionBody
|
||||
/** Represents legacy JWT token */
|
||||
token?: string
|
||||
user?: User
|
||||
key_params?: AnyKeyParamsContent
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { ChangeCredentialsData } from './ChangeCredentialsData'
|
||||
|
||||
export type ChangeCredentialsResponse = HttpResponse & {
|
||||
data: ChangeCredentialsData
|
||||
}
|
||||
17
packages/responses/src/Domain/Auth/KeyParamsData.ts
Normal file
17
packages/responses/src/Domain/Auth/KeyParamsData.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
||||
|
||||
export type KeyParamsData = {
|
||||
identifier?: string
|
||||
pw_cost?: number
|
||||
pw_nonce?: string
|
||||
version?: ProtocolVersion
|
||||
/** Legacy V002 */
|
||||
pw_salt?: string
|
||||
email?: string
|
||||
/** Legacy V001 */
|
||||
pw_func?: string
|
||||
pw_alg?: string
|
||||
pw_key_size?: number
|
||||
origination?: KeyParamsOrigination
|
||||
created?: string
|
||||
}
|
||||
6
packages/responses/src/Domain/Auth/KeyParamsResponse.ts
Normal file
6
packages/responses/src/Domain/Auth/KeyParamsResponse.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { KeyParamsData } from './KeyParamsData'
|
||||
|
||||
export type KeyParamsResponse = HttpResponse & {
|
||||
data: KeyParamsData
|
||||
}
|
||||
9
packages/responses/src/Domain/Auth/RegistrationData.ts
Normal file
9
packages/responses/src/Domain/Auth/RegistrationData.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { SessionBody } from './SessionBody'
|
||||
import { User } from './User'
|
||||
|
||||
export type RegistrationData = {
|
||||
session?: SessionBody
|
||||
/** Represents legacy JWT token */
|
||||
token?: string
|
||||
user?: User
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { RegistrationData } from './RegistrationData'
|
||||
|
||||
export type RegistrationResponse = HttpResponse & {
|
||||
data: RegistrationData
|
||||
}
|
||||
7
packages/responses/src/Domain/Auth/SessionBody.ts
Normal file
7
packages/responses/src/Domain/Auth/SessionBody.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export type SessionBody = {
|
||||
access_token: string
|
||||
refresh_token: string
|
||||
access_expiration: number
|
||||
refresh_expiration: number
|
||||
readonly_access: boolean
|
||||
}
|
||||
8
packages/responses/src/Domain/Auth/SessionListEntry.ts
Normal file
8
packages/responses/src/Domain/Auth/SessionListEntry.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export type SessionListEntry = {
|
||||
uuid: string
|
||||
current: boolean
|
||||
api_version: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
device_info: string
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { SessionListEntry } from './SessionListEntry'
|
||||
|
||||
export type SessionListResponse = HttpResponse & { data: SessionListEntry[] }
|
||||
5
packages/responses/src/Domain/Auth/SessionRenewalData.ts
Normal file
5
packages/responses/src/Domain/Auth/SessionRenewalData.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { SessionBody } from './SessionBody'
|
||||
|
||||
export type SessionRenewalData = {
|
||||
session?: SessionBody
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { SessionRenewalData } from './SessionRenewalData'
|
||||
|
||||
export type SessionRenewalResponse = HttpResponse & {
|
||||
data: SessionRenewalData
|
||||
}
|
||||
11
packages/responses/src/Domain/Auth/SignInData.ts
Normal file
11
packages/responses/src/Domain/Auth/SignInData.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { AnyKeyParamsContent } from '@standardnotes/common'
|
||||
import { SessionBody } from './SessionBody'
|
||||
import { User } from './User'
|
||||
|
||||
export type SignInData = {
|
||||
session?: SessionBody
|
||||
/** Represents legacy JWT token */
|
||||
token?: string
|
||||
user?: User
|
||||
key_params?: AnyKeyParamsContent
|
||||
}
|
||||
6
packages/responses/src/Domain/Auth/SignInResponse.ts
Normal file
6
packages/responses/src/Domain/Auth/SignInResponse.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { SignInData } from './SignInData'
|
||||
|
||||
export type SignInResponse = HttpResponse & {
|
||||
data: SignInData
|
||||
}
|
||||
3
packages/responses/src/Domain/Auth/SignOutResponse.ts
Normal file
3
packages/responses/src/Domain/Auth/SignOutResponse.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
|
||||
export type SignOutResponse = HttpResponse & Record<string, unknown>
|
||||
4
packages/responses/src/Domain/Auth/User.ts
Normal file
4
packages/responses/src/Domain/Auth/User.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export type User = {
|
||||
uuid: string
|
||||
email: string
|
||||
}
|
||||
11
packages/responses/src/Domain/Error/ClientError.ts
Normal file
11
packages/responses/src/Domain/Error/ClientError.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Error } from '../Http/Error'
|
||||
|
||||
export class ClientDisplayableError {
|
||||
constructor(public text: string, public title?: string, public tag?: string) {
|
||||
console.error('Client Displayable Error:', text, title || '', tag || '')
|
||||
}
|
||||
|
||||
static FromError(error: Error) {
|
||||
return new ClientDisplayableError(error.message, undefined, error.tag)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type CloseUploadSessionResponse = MinimalHttpResponse & {
|
||||
success: boolean
|
||||
message: string
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export type CreateValetTokenPayload = {
|
||||
operation: 'read' | 'write' | 'delete'
|
||||
resources: Array<{
|
||||
remoteIdentifier: string
|
||||
unencryptedFileSize?: number
|
||||
}>
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
import { CreateValetTokenResponseData } from './CreateValetTokenResponseData'
|
||||
|
||||
export type CreateValetTokenResponse = MinimalHttpResponse & {
|
||||
data: CreateValetTokenResponseData
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export type CreateValetTokenResponseData =
|
||||
| {
|
||||
success: true
|
||||
valetToken: string
|
||||
}
|
||||
| {
|
||||
success: false
|
||||
reason: 'no-subscription' | 'expired-subscription' | 'invalid-parameters'
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type DownloadFileChunkResponse = MinimalHttpResponse & {
|
||||
data: ArrayBuffer
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type StartUploadSessionResponse = MinimalHttpResponse & {
|
||||
success: boolean
|
||||
uploadId: string
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type UploadFileChunkResponse = MinimalHttpResponse & {
|
||||
success: boolean
|
||||
}
|
||||
10
packages/responses/src/Domain/Http/Error.ts
Normal file
10
packages/responses/src/Domain/Http/Error.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export type Error = {
|
||||
message: string
|
||||
status: number
|
||||
tag?: string
|
||||
/** In the case of MFA required responses,
|
||||
* the required prompt is returned as part of the error */
|
||||
payload?: {
|
||||
mfa_key?: string
|
||||
}
|
||||
}
|
||||
6
packages/responses/src/Domain/Http/Functions.ts
Normal file
6
packages/responses/src/Domain/Http/Functions.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from './HttpResponse'
|
||||
import { StatusCode } from './StatusCode'
|
||||
|
||||
export function isErrorResponseExpiredToken(errorResponse: HttpResponse): boolean {
|
||||
return errorResponse.status === StatusCode.HttpStatusExpiredAccessToken
|
||||
}
|
||||
13
packages/responses/src/Domain/Http/HttpResponse.ts
Normal file
13
packages/responses/src/Domain/Http/HttpResponse.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { StatusCode } from './StatusCode'
|
||||
import { Error } from './Error'
|
||||
import { ResponseMeta } from './ResponseMeta'
|
||||
|
||||
export type HttpResponse = {
|
||||
status?: StatusCode
|
||||
error?: Error
|
||||
data?: {
|
||||
error?: Error
|
||||
}
|
||||
meta?: ResponseMeta
|
||||
headers?: Map<string, string | null>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { StatusCode } from './StatusCode'
|
||||
import { Error } from './Error'
|
||||
|
||||
export type MinimalHttpResponse = {
|
||||
status?: StatusCode
|
||||
error?: Error
|
||||
headers?: Map<string, string | null>
|
||||
}
|
||||
12
packages/responses/src/Domain/Http/ResponseMeta.ts
Normal file
12
packages/responses/src/Domain/Http/ResponseMeta.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Role } from '@standardnotes/security'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
|
||||
export type ResponseMeta = {
|
||||
auth: {
|
||||
userUuid?: Uuid
|
||||
roles?: Role[]
|
||||
}
|
||||
server: {
|
||||
filesServerUrl?: string
|
||||
}
|
||||
}
|
||||
16
packages/responses/src/Domain/Http/StatusCode.ts
Normal file
16
packages/responses/src/Domain/Http/StatusCode.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export enum StatusCode {
|
||||
LocalValidationError = 10,
|
||||
CanceledMfa = 11,
|
||||
UnknownError = 12,
|
||||
|
||||
HttpStatusMinSuccess = 200,
|
||||
HttpStatusNoContent = 204,
|
||||
HttpStatusMaxSuccess = 299,
|
||||
/** The session's access token is expired, but the refresh token is valid */
|
||||
HttpStatusExpiredAccessToken = 498,
|
||||
/** The session's access token and refresh token are expired, user must reauthenticate */
|
||||
HttpStatusInvalidSession = 401,
|
||||
/** User's IP is rate-limited. */
|
||||
HttpStatusForbidden = 403,
|
||||
HttpBadRequest = 400,
|
||||
}
|
||||
7
packages/responses/src/Domain/Item/ApiEndpointParam.ts
Normal file
7
packages/responses/src/Domain/Item/ApiEndpointParam.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export enum ApiEndpointParam {
|
||||
LastSyncToken = 'sync_token',
|
||||
PaginationToken = 'cursor_token',
|
||||
SyncDlLimit = 'limit',
|
||||
SyncPayloads = 'items',
|
||||
ApiVersion = 'api',
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
import { IntegrityPayload } from './IntegrityPayload'
|
||||
|
||||
export type CheckIntegrityResponse = MinimalHttpResponse & {
|
||||
data: {
|
||||
mismatches: IntegrityPayload[]
|
||||
}
|
||||
}
|
||||
11
packages/responses/src/Domain/Item/ConflictParams.ts
Normal file
11
packages/responses/src/Domain/Item/ConflictParams.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ConflictType } from './ConflictType'
|
||||
import { ServerItemResponse } from './ServerItemResponse'
|
||||
|
||||
export type ConflictParams = {
|
||||
type: ConflictType
|
||||
server_item?: ServerItemResponse
|
||||
unsaved_item?: ServerItemResponse
|
||||
|
||||
/** @legacay */
|
||||
item?: ServerItemResponse
|
||||
}
|
||||
9
packages/responses/src/Domain/Item/ConflictType.ts
Normal file
9
packages/responses/src/Domain/Item/ConflictType.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export enum ConflictType {
|
||||
ConflictingData = 'sync_conflict',
|
||||
UuidConflict = 'uuid_conflict',
|
||||
ContentTypeError = 'content_type_error',
|
||||
ContentError = 'content_error',
|
||||
ReadOnlyError = 'readonly_error',
|
||||
UuidError = 'uuid_error',
|
||||
SyncError = 'sync_error',
|
||||
}
|
||||
14
packages/responses/src/Domain/Item/GetSingleItemResponse.ts
Normal file
14
packages/responses/src/Domain/Item/GetSingleItemResponse.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
import { ServerItemResponse } from './ServerItemResponse'
|
||||
|
||||
export type GetSingleItemResponse = MinimalHttpResponse & {
|
||||
data:
|
||||
| {
|
||||
success: true
|
||||
item: ServerItemResponse
|
||||
}
|
||||
| {
|
||||
success: false
|
||||
message: string
|
||||
}
|
||||
}
|
||||
6
packages/responses/src/Domain/Item/IntegrityPayload.ts
Normal file
6
packages/responses/src/Domain/Item/IntegrityPayload.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { MicrosecondsTimestamp, Uuid } from '@standardnotes/common'
|
||||
|
||||
export type IntegrityPayload = {
|
||||
uuid: Uuid
|
||||
updated_at_timestamp: MicrosecondsTimestamp
|
||||
}
|
||||
14
packages/responses/src/Domain/Item/RawSyncData.ts
Normal file
14
packages/responses/src/Domain/Item/RawSyncData.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { ApiEndpointParam } from './ApiEndpointParam'
|
||||
import { ConflictParams } from './ConflictParams'
|
||||
import { ServerItemResponse } from './ServerItemResponse'
|
||||
|
||||
export type RawSyncData = {
|
||||
error?: unknown
|
||||
[ApiEndpointParam.LastSyncToken]?: string
|
||||
[ApiEndpointParam.PaginationToken]?: string
|
||||
retrieved_items?: ServerItemResponse[]
|
||||
saved_items?: ServerItemResponse[]
|
||||
conflicts?: ConflictParams[]
|
||||
unsaved?: ConflictParams[]
|
||||
status?: number
|
||||
}
|
||||
4
packages/responses/src/Domain/Item/RawSyncResponse.ts
Normal file
4
packages/responses/src/Domain/Item/RawSyncResponse.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { RawSyncData } from './RawSyncData'
|
||||
|
||||
export type RawSyncResponse = HttpResponse & { data: RawSyncData }
|
||||
10
packages/responses/src/Domain/Item/RevisionListEntry.ts
Normal file
10
packages/responses/src/Domain/Item/RevisionListEntry.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { RoleName } from '@standardnotes/common'
|
||||
|
||||
export type RevisionListEntry = {
|
||||
content_type: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
/** The uuid of the revision */
|
||||
uuid: string
|
||||
required_role: RoleName
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { RevisionListEntry } from './RevisionListEntry'
|
||||
|
||||
export type RevisionListResponse = HttpResponse & { data: RevisionListEntry[] }
|
||||
15
packages/responses/src/Domain/Item/ServerItemResponse.ts
Normal file
15
packages/responses/src/Domain/Item/ServerItemResponse.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
|
||||
export interface ServerItemResponse {
|
||||
content_type: ContentType
|
||||
content: string | undefined
|
||||
created_at_timestamp: number
|
||||
created_at: Date
|
||||
deleted: boolean
|
||||
duplicate_of?: Uuid
|
||||
enc_item_key: string
|
||||
items_key_id?: string
|
||||
updated_at_timestamp: number
|
||||
updated_at: Date
|
||||
uuid: string
|
||||
}
|
||||
15
packages/responses/src/Domain/Item/SingleRevision.ts
Normal file
15
packages/responses/src/Domain/Item/SingleRevision.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
|
||||
export type SingleRevision = {
|
||||
auth_hash?: string
|
||||
content_type: ContentType
|
||||
content: string
|
||||
created_at: string
|
||||
enc_item_key: string
|
||||
/** The uuid of the item this revision was created with */
|
||||
item_uuid: string
|
||||
items_key_id: string
|
||||
updated_at: string
|
||||
/** The uuid of the revision */
|
||||
uuid: Uuid
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { SingleRevision } from './SingleRevision'
|
||||
|
||||
export type SingleRevisionResponse = HttpResponse & {
|
||||
data: SingleRevision
|
||||
}
|
||||
13
packages/responses/src/Domain/Listed/ActionResponse.ts
Normal file
13
packages/responses/src/Domain/Listed/ActionResponse.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AnyKeyParamsContent, ContentType } from '@standardnotes/common'
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { ServerItemResponse } from '../Item/ServerItemResponse'
|
||||
|
||||
export type ActionResponse = HttpResponse & {
|
||||
description: string
|
||||
supported_types: ContentType[]
|
||||
deprecation?: string
|
||||
actions: unknown[]
|
||||
item?: ServerItemResponse
|
||||
keyParams?: AnyKeyParamsContent
|
||||
auth_params?: AnyKeyParamsContent
|
||||
}
|
||||
5
packages/responses/src/Domain/Listed/ListedAccount.ts
Normal file
5
packages/responses/src/Domain/Listed/ListedAccount.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export type ListedAccount = {
|
||||
secret: string
|
||||
authorId: string
|
||||
hostUrl: string
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ActionResponse } from './ActionResponse'
|
||||
|
||||
export type ListedAccountInfo = ActionResponse & {
|
||||
display_name: string
|
||||
author_url: string
|
||||
settings_url: string
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { ListedAccountInfo } from './ListedAccountInfo'
|
||||
|
||||
export type ListedAccountInfoResponse = HttpResponse & {
|
||||
data: ListedAccountInfo
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type ListedRegistrationResponse = MinimalHttpResponse & {
|
||||
data?: unknown
|
||||
}
|
||||
13
packages/responses/src/Domain/User/AvailableSubscriptions.ts
Normal file
13
packages/responses/src/Domain/User/AvailableSubscriptions.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { FeatureDescription } from '@standardnotes/features'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
|
||||
export type AvailableSubscriptions = {
|
||||
[key in SubscriptionName]: {
|
||||
name: string
|
||||
pricing: {
|
||||
price: number
|
||||
period: string
|
||||
}[]
|
||||
features: FeatureDescription[]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type DeleteSettingResponse = MinimalHttpResponse
|
||||
@@ -0,0 +1,6 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
import { AvailableSubscriptions } from './AvailableSubscriptions'
|
||||
|
||||
export type GetAvailableSubscriptionsResponse = MinimalHttpResponse & {
|
||||
data?: AvailableSubscriptions
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { FeatureDescription } from '@standardnotes/features'
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type GetOfflineFeaturesResponse = MinimalHttpResponse & {
|
||||
data?: {
|
||||
features: FeatureDescription[]
|
||||
}
|
||||
}
|
||||
9
packages/responses/src/Domain/User/GetSettingResponse.ts
Normal file
9
packages/responses/src/Domain/User/GetSettingResponse.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
import { SettingData } from './SettingData'
|
||||
|
||||
export type GetSettingResponse = MinimalHttpResponse & {
|
||||
data?: {
|
||||
success?: boolean
|
||||
setting?: SettingData
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Subscription } from '@standardnotes/security'
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type GetSubscriptionResponse = MinimalHttpResponse & {
|
||||
data?: {
|
||||
subscription?: Subscription
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
import { SettingData } from './SettingData'
|
||||
|
||||
export type ListSettingsResponse = MinimalHttpResponse & {
|
||||
data?: {
|
||||
settings?: SettingData[]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type PostSubscriptionTokensResponse = MinimalHttpResponse & {
|
||||
data?: {
|
||||
token: string
|
||||
}
|
||||
}
|
||||
6
packages/responses/src/Domain/User/SettingData.ts
Normal file
6
packages/responses/src/Domain/User/SettingData.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export type SettingData = {
|
||||
uuid: string
|
||||
name: string
|
||||
value: string
|
||||
sensitive?: boolean
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
|
||||
|
||||
export type UpdateSettingResponse = MinimalHttpResponse
|
||||
5
packages/responses/src/Domain/User/UserFeaturesData.ts
Normal file
5
packages/responses/src/Domain/User/UserFeaturesData.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { FeatureDescription } from '@standardnotes/features'
|
||||
|
||||
export type UserFeaturesData = {
|
||||
features: FeatureDescription[]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HttpResponse } from '../Http/HttpResponse'
|
||||
import { UserFeaturesData } from './UserFeaturesData'
|
||||
|
||||
export type UserFeaturesResponse = HttpResponse & {
|
||||
data: UserFeaturesData
|
||||
}
|
||||
59
packages/responses/src/Domain/index.ts
Normal file
59
packages/responses/src/Domain/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
export * from './Auth/ChangeCredentialsData'
|
||||
export * from './Auth/ChangeCredentialsResponse'
|
||||
export * from './Auth/KeyParamsData'
|
||||
export * from './Auth/KeyParamsResponse'
|
||||
export * from './Auth/RegistrationData'
|
||||
export * from './Auth/RegistrationResponse'
|
||||
export * from './Auth/SessionBody'
|
||||
export * from './Auth/SessionListEntry'
|
||||
export * from './Auth/SessionListResponse'
|
||||
export * from './Auth/SessionRenewalData'
|
||||
export * from './Auth/SessionRenewalResponse'
|
||||
export * from './Auth/SignInData'
|
||||
export * from './Auth/SignInResponse'
|
||||
export * from './Auth/SignOutResponse'
|
||||
export * from './Auth/User'
|
||||
export * from './Error/ClientError'
|
||||
export * from './Files/CloseUploadSessionResponse'
|
||||
export * from './Files/CreateValetTokenPayload'
|
||||
export * from './Files/CreateValetTokenResponse'
|
||||
export * from './Files/CreateValetTokenResponseData'
|
||||
export * from './Files/DownloadFileChunkResponse'
|
||||
export * from './Files/StartUploadSessionResponse'
|
||||
export * from './Files/UploadFileChunkResponse'
|
||||
export * from './Http/Error'
|
||||
export * from './Http/Functions'
|
||||
export * from './Http/HttpResponse'
|
||||
export * from './Http/MinimalHttpResponses'
|
||||
export * from './Http/ResponseMeta'
|
||||
export * from './Http/StatusCode'
|
||||
export * from './Item/ApiEndpointParam'
|
||||
export * from './Item/CheckIntegrityResponse'
|
||||
export * from './Item/ConflictParams'
|
||||
export * from './Item/ConflictType'
|
||||
export * from './Item/GetSingleItemResponse'
|
||||
export * from './Item/RawSyncData'
|
||||
export * from './Item/RawSyncResponse'
|
||||
export * from './Item/RevisionListEntry'
|
||||
export * from './Item/RevisionListResponse'
|
||||
export * from './Item/ServerItemResponse'
|
||||
export * from './Item/SingleRevision'
|
||||
export * from './Item/SingleRevisionResponse'
|
||||
export * from './Item/IntegrityPayload'
|
||||
export * from './Listed/ActionResponse'
|
||||
export * from './Listed/ListedAccount'
|
||||
export * from './Listed/ListedAccountInfo'
|
||||
export * from './Listed/ListedAccountInfoResponse'
|
||||
export * from './Listed/ListedRegistrationResponse'
|
||||
export * from './User/AvailableSubscriptions'
|
||||
export * from './User/DeleteSettingResponse'
|
||||
export * from './User/GetAvailableSubscriptionsResponse'
|
||||
export * from './User/GetOfflineFeaturesResponse'
|
||||
export * from './User/GetSettingResponse'
|
||||
export * from './User/GetSubscriptionResponse'
|
||||
export * from './User/ListSettingsResponse'
|
||||
export * from './User/PostSubscriptionTokensResponse'
|
||||
export * from './User/SettingData'
|
||||
export * from './User/UpdateSettingResponse'
|
||||
export * from './User/UserFeaturesData'
|
||||
export * from './User/UserFeaturesResponse'
|
||||
1
packages/responses/src/index.ts
Normal file
1
packages/responses/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Domain'
|
||||
Reference in New Issue
Block a user