API#

puschel provides a GraphQL API for thirs-party integrations.

Authorization#

For API requests you need to be authorized. Use the /auth/login endpoint via POST and a JSON body like:

{
  "username": "admin",
  "password": "puschel"
}

The return value looks like:

{
  "access_token": "ACCESS_TOKEN",
  "user_id": "USER_ID"
}

Use the access_token with the HTTP header like Authorization: Bearer ACCESS_TOKEN to query the API.

Query#

Field Argument Type Description
findToys [Toy!]!
findToy Toy!
id Int!
findToyByName Toy!
name String!
findRideEvents [RideEvent!]!
findRideEvent RideEvent!
id Int!
findLastRideEventByRun RideEvent
id Int!
findSatisfiers [Satisfier!]!
findSatisfier Satisfier!
id Int!
findSmartWatches [SmartWatch!]!
findRatings [Rating!]!
findRating Rating!
id Int!
findRuns [Run!]!
findRun Run!
id Int!
findRunsByPlay [Run!]!
name String!
findRides [Ride!]!
findRide Ride!
id Int!
findPlays [Play!]!
findPlay Play!
id Int!
findPlayByName Play!
name String!
findActivePlay Play
findUsers [User!]!
findUser User!
id Int!
findCurrentUser User!
findUserByUsername User!
username String!
findSettings Settings!

Mutation#

Field Argument Type Description
updateToy Toy!
toy ToyDto!
createRideEvent RideEvent!
event RideEventDto!
createRating Rating!
rating RatingDto!
deleteRating Rating!
id Int!
startPlay Play!
id Int!
stopPlay Play!
id Int!
createPlay Play!
play PlayDto!
updatePlay Play!
play PlayDto!
deletePlay Play!
id Int!
createUser User!
user UserDto!
updateUser User!
user UserDto!
deleteUser User!
id Int!
updateSettings Settings!
settings SettingsDto!

Objects#

Play#

Field Argument Type Description
id Int!
name String
description String
timelines [Timeline!]
runs [Run!]

Rating#

Field Argument Type Description
id Int!
score Float
orgasms Int
message String
date DateTime
run Run
user User
playId Int
userId Int

Ride#

Field Argument Type Description
id Int!
enabled Boolean
index Int
length Int
timeline Timeline
satisfier Satisfier
toyAssignment String

RideEvent#

Field Argument Type Description
id Int!
date DateTime
payload JSON
run Run

Run#

Field Argument Type Description
id Int!
paused Boolean
active Boolean
startDate DateTime
runTime Float
play Play
ratings [Rating!]

Satisfier#

Field Argument Type Description
id Int!
type String
settings JSON
ride Ride

Settings#

Field Argument Type Description
wifiSsid String

SmartWatch#

Field Argument Type Description
uuid String
name String

Timeline#

Field Argument Type Description
id Int!
play Play
rides [Ride!]
toy Toy
toyId Int

Toy#

Field Argument Type Description
id Int!
name String
type String
uuid String
timelines [Timeline!]

User#

Field Argument Type Description
id Int!
username String
description String
avatar String
gender String
ratings [Rating!]

Inputs#

PlayDto#

Field Type Description
id Int
name String!

Validation: [matches: (^[\d\w ]+$), isNotEmpty]

description String!

Validation: [isNotEmpty]

timelines [TimelineDto!]!

Validation: [arrayNotEmpty, isArray]

RatingDto#

Field Type Description
score Float!

Validation: [max: (1), min: (0)]

orgasms Int!

Validation: [max: (10), min: (0)]

message String!

Validation: [isNotEmpty]

runId Int!

RideDto#

Field Type Description
id Int
enabled Boolean!
toyAssignment String!

Validation: [isEnum: (vibrate, warm, push, electrify, pattern)]

index Int!

Validation: [min: (0)]

length Int!

Validation: [min: (1)]

satisfier SatisfierDto!

Validation: [isNotEmpty]

timelineId Int

RideEventDto#

Field Type Description
payload JSON

SatisfierDto#

Field Type Description
id Int
type String!

Validation: [isEnum: (random, peak, manual, replay, smartWatch, ai)]

settings JSON

Validation: []

SettingsDto#

Field Type Description
adminPassword String!

Validation: [matches: (^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]+$), maxLength: (20), minLength: (6)]

wifiSsid String!
wifiPassword String!

TimelineDto#

Field Type Description
id Int
toyId Int!

Validation: [min: (1)]

rides [RideDto!]!

Validation: [arrayNotEmpty, isArray]

ToyDto#

Field Type Description
id Int
name String!

Validation: [matches: (^[\d\w ]+$), isNotEmpty]

UserDto#

Field Type Description
id Int
username String!

Validation: [matches: (^(?![.])(?!.*[.]{2})[a-zA-Z0-9_]+(?<![_.])$), notEquals: (admin), maxLength: (20), minLength: (6)]

description String!

Validation: [isNotEmpty]

password String!

Validation: [matches: (^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]+$), maxLength: (20), minLength: (6)]

avatar String!

Validation: [isNotEmpty]

gender String!

Validation: [isEnum: (xx, xy)]

Scalars#

Boolean#

The Boolean scalar type represents true or false.

DateTime#

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

Float#

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Int#

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

JSON#

The JSON scalar type represents JSON values as specified by ECMA-404.

String#

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.