Skip to content

Commit

Permalink
docs: update ts examples
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Sep 28, 2020
1 parent c6a07e9 commit 65cb46e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PublicApi} from '@oryd/kratos-client'
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const kratos = new PublicApi('http://127.0.0.1:4433/')
kratos.initializeSelfServiceLoginViaAPIFlow()
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
.then(({ status, data: flow }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
11 changes: 5 additions & 6 deletions docs/docs/self-service/flows/code/login/samples/get.js.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {CommonApi} from '@oryd/kratos-client'

const kratos = new CommonApi('http://127.0.0.1:4433/')
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const flowId = '' // usually something like: req.query.flow

kratos.getSelfServiceLoginFlow(flowId)
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
return kratos.getSelfServiceLoginFlow(flowId)
.then(({ status, data: flow, ...response }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PublicApi} from '@oryd/kratos-client'
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const kratos = new PublicApi('http://127.0.0.1:4433/')
kratos.initializeSelfServiceRecoveryViaAPIFlow()
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
.then(({ status, data: flow }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
9 changes: 4 additions & 5 deletions docs/docs/self-service/flows/code/recovery/samples/get.js.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {CommonApi} from '@oryd/kratos-client'

const kratos = new CommonApi('http://127.0.0.1:4433/')
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const flowId = '' // usually something like: req.query.flow

kratos.getSelfServiceRecoveryFlow(flowId)
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
.then(({ status, data: flow, ...response }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PublicApi} from '@oryd/kratos-client'
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const kratos = new PublicApi('http://127.0.0.1:4433/')
kratos.initializeSelfServiceRegistrationViaAPIFlow()
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
.then(({ status, data: flow }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {CommonApi} from '@oryd/kratos-client'

const kratos = new CommonApi('http://127.0.0.1:4433/')
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const flowId = '' // usually something like: req.query.flow

kratos.getSelfServiceRegistrationFlow(flowId)
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
.then(({ status, data: flow, ...response }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PublicApi} from '@oryd/kratos-client'
import { Configuration, PublicApi } from '@oryd/kratos-client';
const kratos = new PublicApi(new Configuration({ basePath: 'http://127.0.0.1:4433/' }));

const kratos = new PublicApi('http://127.0.0.1:4433/')
kratos.initializeSelfServiceRegistrationViaAPIFlow()
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
kratos.initializeSelfServiceSettingsViaAPIFlow()
.then(({ status, data: flow }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})
8 changes: 4 additions & 4 deletions docs/docs/self-service/flows/code/settings/samples/get.js.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {CommonApi} from '@oryd/kratos-client'
import { AdminApi, Configuration } from '@oryd/kratos-client';

// We are using the ORY Kratos Admin API (:4434) to avoid having to set the session cookie / session token:
const kratos = new CommonApi('http://127.0.0.1:4434/')
const kratos = new AdminApi(new Configuration({ basePath: 'http://127.0.0.1:4434/' }));

const flowId = '' // usually something like: req.query.flow

kratos.getSelfServiceSettingsFlow(flowId)
.then(({body}) => {
console.log(body) // see the Raw HTTP tab for the payload
.then(({ status, data: flow, ...response }) => {
console.log(flow) // see the Raw HTTP tab for the payload
})

0 comments on commit 65cb46e

Please sign in to comment.