Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bb962cee3 | ||
|
|
3bfaf17bf3 | ||
|
|
bbdb3b62a4 | ||
|
|
3c569db660 | ||
|
|
fb0e177d91 | ||
|
|
7ad0b30f34 | ||
|
|
d7e82d5a80 |
@@ -0,0 +1 @@
|
|||||||
|
next-env.d.ts
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import nextPlugin from '@next/eslint-plugin-next';
|
||||||
|
import prettierPlugin from 'eslint-plugin-prettier';
|
||||||
|
import prettierConfig from 'eslint-config-prettier';
|
||||||
|
import tsParser from '@typescript-eslint/parser';
|
||||||
|
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'.next/**',
|
||||||
|
'node_modules/**',
|
||||||
|
'coverage/**',
|
||||||
|
'.swc/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.{js,mjs,cjs,ts,tsx}'],
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
'@next/next': nextPlugin,
|
||||||
|
'@typescript-eslint': tsPlugin,
|
||||||
|
prettier: prettierPlugin,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...nextPlugin.configs.recommended.rules,
|
||||||
|
...nextPlugin.configs['core-web-vitals'].rules,
|
||||||
|
...tsPlugin.configs.recommended.rules,
|
||||||
|
'prettier/prettier': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
endOfLine: 'auto',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prettierConfig,
|
||||||
|
];
|
||||||
+3
-2
@@ -1,10 +1,11 @@
|
|||||||
import nextJest from 'next/jest';
|
import type { Config } from 'jest';
|
||||||
|
import nextJest from 'next/jest.js';
|
||||||
|
|
||||||
const createJestConfig = nextJest({
|
const createJestConfig = nextJest({
|
||||||
dir: './',
|
dir: './',
|
||||||
});
|
});
|
||||||
|
|
||||||
const config = {
|
const config: Config = {
|
||||||
testEnvironment: 'jest-environment-jsdom',
|
testEnvironment: 'jest-environment-jsdom',
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
|
|||||||
+1
-5
@@ -1,8 +1,4 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {};
|
||||||
experimental: {
|
|
||||||
appDir: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = nextConfig;
|
module.exports = nextConfig;
|
||||||
|
|||||||
Generated
+6085
-8938
File diff suppressed because it is too large
Load Diff
+25
-22
@@ -6,33 +6,36 @@
|
|||||||
"dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
"dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "eslint .",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test-coverage": "jest && live-server coverage/"
|
"test-coverage": "jest && live-server coverage/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@markdoc/markdoc": "^0.2.2",
|
"@markdoc/markdoc": "^0.5.7",
|
||||||
"@types/node": "18.15.11",
|
"@types/node": "25.5.0",
|
||||||
"@types/react": "18.0.33",
|
"@types/react": "19.2.14",
|
||||||
"@types/react-dom": "18.0.11",
|
"@types/react-dom": "19.2.3",
|
||||||
"@vercel/analytics": "^1.0.0",
|
"@vercel/analytics": "^2.0.1",
|
||||||
"eslint": "8.38.0",
|
"eslint": "10.1.0",
|
||||||
"eslint-config-next": "13.3.0",
|
"eslint-config-next": "16.2.1",
|
||||||
"next": "13.2.4",
|
"next": "16.2.1",
|
||||||
"prismjs": "^1.29.0",
|
"prismjs": "^1.30.0",
|
||||||
"react": "18.2.0",
|
"react": "19.2.4",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "19.2.4",
|
||||||
"typescript": "5.0.4"
|
"typescript": "6.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@eslint/eslintrc": "^3.3.5",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/dom": "^10.4.1",
|
||||||
"@types/prismjs": "^1.26.0",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"cross-env": "^7.0.3",
|
"@testing-library/react": "^16.3.2",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"@types/prismjs": "^1.26.6",
|
||||||
"jest": "^29.5.0",
|
"cross-env": "^10.1.0",
|
||||||
"jest-environment-jsdom": "^29.5.0",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"prettier": "^2.8.7",
|
"eslint-plugin-prettier": "^5.5.6",
|
||||||
"ts-node": "^10.9.1"
|
"jest": "^30.4.2",
|
||||||
|
"jest-environment-jsdom": "^30.4.1",
|
||||||
|
"prettier": "^3.8.5",
|
||||||
|
"ts-node": "^10.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -2,13 +2,24 @@
|
|||||||
|
|
||||||
import React, {
|
import React, {
|
||||||
Children,
|
Children,
|
||||||
MouseEvent,
|
|
||||||
ReactElement,
|
ReactElement,
|
||||||
ReactNode,
|
ReactNode,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import styles from './CodeSnippet.module.css';
|
import styles from './CodeSnippet.module.css';
|
||||||
|
|
||||||
|
interface MarkdocFenceProps {
|
||||||
|
language?: string;
|
||||||
|
content?: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMarkdocElement(
|
||||||
|
child: ReactNode
|
||||||
|
): child is ReactElement<MarkdocFenceProps> {
|
||||||
|
return React.isValidElement(child);
|
||||||
|
}
|
||||||
|
|
||||||
function CodeSnippetCopyButton({
|
function CodeSnippetCopyButton({
|
||||||
copyText,
|
copyText,
|
||||||
}: {
|
}: {
|
||||||
@@ -20,7 +31,7 @@ function CodeSnippetCopyButton({
|
|||||||
const [showTooltip, setShowTooltip] =
|
const [showTooltip, setShowTooltip] =
|
||||||
useState<boolean>(false);
|
useState<boolean>(false);
|
||||||
|
|
||||||
const handleCopy = (e: MouseEvent<HTMLButtonElement>) => {
|
const handleCopy = () => {
|
||||||
setCopyButtonTooltip(true);
|
setCopyButtonTooltip(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setCopyButtonTooltip(false);
|
setCopyButtonTooltip(false);
|
||||||
@@ -129,30 +140,29 @@ export default function CodeSnippet({
|
|||||||
setSelectedLanguage(e.target.value);
|
setSelectedLanguage(e.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const code = Children.toArray(children)
|
const childrenArray = Children.toArray(children);
|
||||||
.filter(
|
|
||||||
child =>
|
|
||||||
React.isValidElement(child) &&
|
|
||||||
child.props.className ===
|
|
||||||
`language-${selectedLanguage}`
|
|
||||||
)
|
|
||||||
.map(child => {
|
|
||||||
return child as ReactElement;
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
const snippetLanguages = Children.toArray(children).map(
|
const code = childrenArray.find(
|
||||||
child => {
|
(child): child is ReactElement<MarkdocFenceProps> => {
|
||||||
if (React.isValidElement(child)) {
|
if (!isMarkdocElement(child)) return false;
|
||||||
const languageClassParts =
|
const { language, className } = child.props;
|
||||||
child.props.className.split('-');
|
return (
|
||||||
if (languageClassParts.length > 1) {
|
language === selectedLanguage ||
|
||||||
const language = languageClassParts[1];
|
className === `language-${selectedLanguage}`
|
||||||
return language;
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const snippetLanguages = childrenArray
|
||||||
|
.map(child => {
|
||||||
|
if (isMarkdocElement(child)) {
|
||||||
|
const { language, className } = child.props;
|
||||||
|
return language || className?.split('-')[1];
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
})
|
||||||
|
.filter((l): l is string => typeof l === 'string');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.snippetContainer}>
|
<div className={styles.snippetContainer}>
|
||||||
<div className={styles.snippetHeader}>
|
<div className={styles.snippetHeader}>
|
||||||
@@ -176,7 +186,7 @@ export default function CodeSnippet({
|
|||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
<CodeSnippetCopyButton
|
<CodeSnippetCopyButton
|
||||||
copyText={code.props.content}
|
copyText={code?.props.content ?? ''}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'prismjs/components/prism-bash';
|
|||||||
import 'prismjs/components/prism-csharp';
|
import 'prismjs/components/prism-csharp';
|
||||||
import 'prismjs/components/prism-json';
|
import 'prismjs/components/prism-json';
|
||||||
import 'prismjs/components/prism-python';
|
import 'prismjs/components/prism-python';
|
||||||
|
import 'prismjs/components/prism-rust';
|
||||||
|
import 'prismjs/components/prism-go';
|
||||||
import './prism-custom.css';
|
import './prism-custom.css';
|
||||||
|
|
||||||
export default function Fence({
|
export default function Fence({
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ChangeEvent } from 'react';
|
||||||
import { useSectionContext } from '../context/section';
|
import { useSectionContext } from '../context/section';
|
||||||
import { Doc, DocsStructure } from '../types/types';
|
import { Doc, DocsStructure } from '../types/types';
|
||||||
import { toKebabCase } from '../utils/stringUtils';
|
import { toKebabCase } from '../utils/stringUtils';
|
||||||
@@ -9,7 +10,9 @@ export default function SectionDropdown({
|
|||||||
version: DocsStructure;
|
version: DocsStructure;
|
||||||
}) {
|
}) {
|
||||||
const { section, setSection } = useSectionContext();
|
const { section, setSection } = useSectionContext();
|
||||||
const handleSelectChange = (e: any) => {
|
const handleSelectChange = (
|
||||||
|
e: ChangeEvent<HTMLSelectElement>
|
||||||
|
) => {
|
||||||
setSection(e.target.value);
|
setSection(e.target.value);
|
||||||
location.hash = e.target.value;
|
location.hash = e.target.value;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,14 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
const SectionContext = createContext({});
|
type SectionContextType = {
|
||||||
|
section: string;
|
||||||
|
setSection: (section: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const SectionContext = createContext<
|
||||||
|
SectionContextType | undefined
|
||||||
|
>(undefined);
|
||||||
|
|
||||||
export const SectionContextProvider = ({
|
export const SectionContextProvider = ({
|
||||||
children,
|
children,
|
||||||
@@ -25,5 +32,12 @@ export const SectionContextProvider = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useSectionContext: any = () =>
|
export const useSectionContext = (): SectionContextType => {
|
||||||
useContext(SectionContext);
|
const context = useContext(SectionContext);
|
||||||
|
if (!context) {
|
||||||
|
throw new Error(
|
||||||
|
'useSectionContext must be used within SectionContextProvider'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
};
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
|
interface ThemeContextType {
|
||||||
|
theme: string;
|
||||||
|
setTheme: (theme: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
const darkTheme = {
|
const darkTheme = {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
backgroundColor: '#05254a',
|
backgroundColor: '#05254a',
|
||||||
@@ -17,7 +22,9 @@ const lightTheme = {
|
|||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
};
|
};
|
||||||
|
|
||||||
const ThemeContext = createContext({});
|
const ThemeContext = createContext<
|
||||||
|
ThemeContextType | undefined
|
||||||
|
>(undefined);
|
||||||
|
|
||||||
export const ThemeContextProvider = ({
|
export const ThemeContextProvider = ({
|
||||||
children,
|
children,
|
||||||
@@ -38,5 +45,12 @@ export const themes = {
|
|||||||
light: lightTheme,
|
light: lightTheme,
|
||||||
} as { [key: string]: { [key: string]: string } };
|
} as { [key: string]: { [key: string]: string } };
|
||||||
|
|
||||||
export const useThemeContext: any = () =>
|
export const useThemeContext = (): ThemeContextType => {
|
||||||
useContext(ThemeContext);
|
const context = useContext(ThemeContext);
|
||||||
|
if (!context) {
|
||||||
|
throw new Error(
|
||||||
|
'useThemeContext must be used within ThemeContextProvider'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
};
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ export default function GlobalError({
|
|||||||
error: Error;
|
error: Error;
|
||||||
reset: () => void;
|
reset: () => void;
|
||||||
}) {
|
}) {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<h2>Something went wrong!</h2>
|
<h2>Something went wrong!</h2>
|
||||||
|
|||||||
+6
-5
@@ -15,11 +15,12 @@ export const metadata = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
viewport: {
|
};
|
||||||
width: 'device-width',
|
|
||||||
initialScale: 1,
|
export const viewport = {
|
||||||
maximumScale: 1,
|
width: 'device-width',
|
||||||
},
|
initialScale: 1,
|
||||||
|
maximumScale: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
|
|||||||
+15
-3
@@ -83,7 +83,7 @@ function parseMarkdown(sourcePath: string): ReactNode {
|
|||||||
const ast = Markdoc.parse(source);
|
const ast = Markdoc.parse(source);
|
||||||
const content = Markdoc.transform(
|
const content = Markdoc.transform(
|
||||||
ast,
|
ast,
|
||||||
markDocConfig as any
|
markDocConfig as never
|
||||||
);
|
);
|
||||||
const children = Markdoc.renderers.react(content, React, {
|
const children = Markdoc.renderers.react(content, React, {
|
||||||
components: {
|
components: {
|
||||||
@@ -102,7 +102,13 @@ function getCopyChild(
|
|||||||
docPath: string
|
docPath: string
|
||||||
) {
|
) {
|
||||||
const copyPath = getCopyPath(version, doc, docPath);
|
const copyPath = getCopyPath(version, doc, docPath);
|
||||||
return parseMarkdown(copyPath);
|
const child = parseMarkdown(copyPath);
|
||||||
|
|
||||||
|
if (React.isValidElement(child)) {
|
||||||
|
return React.cloneElement(child, { key: 'copy' });
|
||||||
|
}
|
||||||
|
|
||||||
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExampleChild(
|
function getExampleChild(
|
||||||
@@ -111,7 +117,13 @@ function getExampleChild(
|
|||||||
docPath: string
|
docPath: string
|
||||||
) {
|
) {
|
||||||
const examplePath = getExamplePath(version, doc, docPath);
|
const examplePath = getExamplePath(version, doc, docPath);
|
||||||
return parseMarkdown(examplePath);
|
const child = parseMarkdown(examplePath);
|
||||||
|
|
||||||
|
if (React.isValidElement(child)) {
|
||||||
|
return React.cloneElement(child, { key: 'example' });
|
||||||
|
}
|
||||||
|
|
||||||
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadSections(
|
export function loadSections(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ console.log(app);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -48,12 +48,45 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
|
|
||||||
response = client.GetAppById(appId=195)
|
response = client.get_app_by_id(app_id=195)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'id: {response.data.app.id}')
|
print(f'id: {response.data.app.id}')
|
||||||
print(f'Name: {response.data.app.name}')
|
print(f'Name: {response.data.app.name}')
|
||||||
print(f'href: {response.data.app.href}')
|
print(f'href: {response.data.app.href}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let app = client.get_app(195).await?;
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"{}, {}",
|
||||||
|
app.id,
|
||||||
|
app.name.unwrap_or_default()
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
app, _ := client.Apps.Get(
|
||||||
|
context.Background(),
|
||||||
|
195,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("%d, %s\n", app.Id, app.Name)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ for (const app of apps) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,18 +52,59 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetApps()
|
response = client.get_apps()
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for app in response.data.apps:
|
for app in response.data.apps:
|
||||||
print(f'Id: {app.id}')
|
print(f'Id: {app.id}')
|
||||||
print(f'Name: {app.name}')
|
print(f'Name: {app.name}')
|
||||||
print(f'href: {app.href}')
|
print(f'href: {app.href}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, PagingRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let paging = PagingRequest {
|
||||||
|
page_number: 1,
|
||||||
|
page_size: 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client.list_apps(Some(paging)).await?;
|
||||||
|
|
||||||
|
for app in response.items.unwrap_or_default() {
|
||||||
|
println!(
|
||||||
|
"{}, {}",
|
||||||
|
app.id,
|
||||||
|
app.name.unwrap_or_default()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
page, _ := client.Apps.List(
|
||||||
|
context.Background(),
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, app := range page.Items {
|
||||||
|
fmt.Printf("%d, %s\n", app.Id, app.Name)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ for (const app of apps) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -56,15 +56,53 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetAppsByIds(appIds=[195, 240])
|
response = client.get_apps_by_ids(app_ids=[195, 240])
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Count: {response.data.count}')
|
print(f'Count: {response.data.count}')
|
||||||
|
|
||||||
for app in response.data.apps:
|
for app in response.data.apps:
|
||||||
print(f'Id: {app.id}')
|
print(f'Id: {app.id}')
|
||||||
print(f'Name: {app.name}')
|
print(f'Name: {app.name}')
|
||||||
print(f'href: {app.href}')
|
print(f'href: {app.href}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let ids = vec![8, 79, 137, 193, 183];
|
||||||
|
let response = client.batch_get_apps(&ids).await?;
|
||||||
|
|
||||||
|
for app in response.items.unwrap_or_default() {
|
||||||
|
println!(
|
||||||
|
"{}, {}",
|
||||||
|
app.id,
|
||||||
|
app.name.unwrap_or_default()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
batch, _ := client.Apps.GetMany(
|
||||||
|
context.Background(),
|
||||||
|
[]int{8, 79, 137, 193, 183},
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, app := range batch.Items {
|
||||||
|
fmt.Printf("%d, %s\n", app.Id, app.Name)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ console.log(res);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -48,12 +48,39 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
|
|
||||||
canConnect = client.CanConnect()
|
canConnect = client.can_connect()
|
||||||
|
|
||||||
if canConnect:
|
if can_connect:
|
||||||
print('Connected successfully')
|
print('Connected successfully')
|
||||||
else:
|
else:
|
||||||
print('Attempt to connect failed')
|
print('Attempt to connect failed')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
client.ping().await?;
|
||||||
|
println!("Connected to the Onspring API successfully.");
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
err := client.Ping.Get(context.Background())
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
fmt.Println("Connected to Onspring API")
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ console.log(field);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -48,10 +48,39 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFieldById(fieldId=6986)
|
response = client.get_field_by_id(field_id=6986)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Field Id: {response.data.id}')
|
print(f'Field Id: {response.data.field.id}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let field = client.get_field(6986).await?;
|
||||||
|
|
||||||
|
println!("Field Id: {}", field.id);
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
field, _ := client.Fields.Get(
|
||||||
|
context.Background(),
|
||||||
|
6986,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("Field Id: %d\n", field.Id)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ for (const field of fields) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,16 +52,54 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFieldsByAppId(appId=195)
|
response = client.get_fields_by_app_id(app_id=195)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Field Id: {field.id}')
|
print(f'Field Id: {field.id}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, PagingRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let paging = PagingRequest {
|
||||||
|
page_number: 1,
|
||||||
|
page_size: 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client.list_fields(195, Some(paging)).await?;
|
||||||
|
|
||||||
|
for field in response.items.unwrap_or_default() {
|
||||||
|
println!("Field Id: {}", field.id);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
page, _ := client.Fields.List(
|
||||||
|
context.Background(),
|
||||||
|
195,
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, field := range page.Items {
|
||||||
|
fmt.Printf("Field Id: %d\n", field.Id)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ for (const field of fields) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -54,13 +54,47 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFieldsByIds(fieldIds=[6983, 6986, 6987, 6985, 6984])
|
response = client.get_fields_by_ids(field_ids=[6983, 6986, 6987, 6985, 6984])
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Count: {response.data.count}')
|
print(f'Count: {response.data.count}')
|
||||||
|
|
||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Field Id: {field.id}')
|
print(f'Field Id: {field.id}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let ids = vec![6983, 6986, 6987, 6985, 6984];
|
||||||
|
let response = client.batch_get_fields(&ids).await?;
|
||||||
|
|
||||||
|
for field in response.items.unwrap_or_default() {
|
||||||
|
println!("Field Id: {}", field.id);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
batch, _ := client.Fields.GetMany(
|
||||||
|
context.Background(),
|
||||||
|
[]int{6983, 6986, 6987, 6985, 6984},
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, field := range batch.Items {
|
||||||
|
fmt.Printf("Field Id: %d\n", field.Id)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ console.log(fileId);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import SaveFileRequest
|
from onspring_api_sdk.models import SaveFileRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -81,19 +81,68 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = SaveFileRequest(
|
request = SaveFileRequest(
|
||||||
recordId=140,
|
record_id=140,
|
||||||
fieldId=6989,
|
field_id=6989,
|
||||||
fileName='test-attachment.txt',
|
file_name='test-attachment.txt',
|
||||||
filePath='test-attachment.txt',
|
file_path='test-attachment.txt',
|
||||||
contentType='text/plain',
|
content_type='text/plain',
|
||||||
notes='Updating record with attachment.',
|
notes='Updating record with attachment.',
|
||||||
modifiedDate=datetime.now()
|
modified_date=datetime.now()
|
||||||
)
|
)
|
||||||
|
|
||||||
response = client.SaveFile(request)
|
response = client.save_file(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'File Id: {response.data.id}')
|
print(f'File Id: {response.data.id}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, SaveFileRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let request = SaveFileRequest {
|
||||||
|
record_id: 140,
|
||||||
|
field_id: 6989,
|
||||||
|
notes: Some(
|
||||||
|
"Updating record with attachment.".to_string()
|
||||||
|
),
|
||||||
|
modified_date: Some(chrono::Utc::now()),
|
||||||
|
file_name: "test-attachment.txt".to_string(),
|
||||||
|
file_data: std::fs::read("test-attachment.txt")?,
|
||||||
|
content_type: "text/plain".to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client.upload_file(request).await?;
|
||||||
|
|
||||||
|
println!("New File Id is: {}", response.id);
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
file, _ := os.Open("test-attachment.txt")
|
||||||
|
|
||||||
|
response, _ := client.Files.Save(
|
||||||
|
context.Background(),
|
||||||
|
onspring.SaveFileRequest{
|
||||||
|
RecordId: 140,
|
||||||
|
FieldId: 6989,
|
||||||
|
Notes: "Updating record with attachment.",
|
||||||
|
FileName: "test-attachment.txt",
|
||||||
|
FileContents: file,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("New File Id is: %d\n", response.Id)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,12 +52,45 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.DeleteFileById(recordId=140, fieldId=6989, fileId=1904)
|
response = client.delete_file_by_id(record_id=140, field_id=6989, fileId=1904)
|
||||||
|
|
||||||
if response.status_code == 204:
|
if response.status_code == 204:
|
||||||
print('File deleted')
|
print('File deleted')
|
||||||
else:
|
else:
|
||||||
print('Error deleting file')
|
print('Error deleting file')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
client.delete_file(140, 6989, 1904).await?;
|
||||||
|
|
||||||
|
println!("File deleted successfully");
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
err := client.Files.Delete(
|
||||||
|
context.Background(),
|
||||||
|
140,
|
||||||
|
6989,
|
||||||
|
1904,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
fmt.Println("File deleted successfully")
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ file.stream.pipe(fs.createWriteStream(file.fileName));
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -61,19 +61,60 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFileById(recordId=1, fieldId=6989, fileId=89)
|
response = client.get_file_by_id(record_id=1, field_id=6989, fileId=89)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Name: {response.data.file.name}')
|
print(f'Name: {response.data.file.name}')
|
||||||
print(f'Content Type: {response.data.file.contentType}')
|
print(f'Content Type: {response.data.file.content_type}')
|
||||||
print(f'Content Length: {response.data.file.contentLength}')
|
print(f'Content Length: {response.data.file.content_length}')
|
||||||
|
|
||||||
filePath = f'C:\\Users\\sfree\\Documents\\Temp\\{response.data.file.name}'
|
file_path = f'C:\\Users\\sfree\\Documents\\Temp\\{response.data.file.name}'
|
||||||
|
|
||||||
with open(filePath, "wb") as file:
|
with open(file_path, "wb") as file:
|
||||||
file.write(response.data.file.content)
|
file.write(response.data.file.content)
|
||||||
|
|
||||||
print(f'File Location: {filePath}')
|
print(f'File Location: {file_path}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let file = client
|
||||||
|
.get_file(1, 6989, 89)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("File Name: {:?}", file.file_name);
|
||||||
|
println!("Content Type: {:?}", file.content_type);
|
||||||
|
println!("Size: {} bytes", file.data.len());
|
||||||
|
|
||||||
|
std::fs::write(&file.file_name, &file.data)?;
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
file, _ := client.Files.GetContent(
|
||||||
|
context.Background(),
|
||||||
|
1,
|
||||||
|
6989,
|
||||||
|
89,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("File Name: %s\n", file.FileName)
|
||||||
|
fmt.Printf("Content Type: %s\n", file.ContentType)
|
||||||
|
fmt.Printf("Size: %d bytes\n", len(file.Data))
|
||||||
|
|
||||||
|
os.WriteFile(file.FileName, file.Data, 0644)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ console.log(fileInfo);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -47,10 +47,45 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFileInfoById(recordId=1, fieldId=6989, fileId=89)
|
response = client.get_file_info_by_id(record_id=1, field_id=6989, fileId=89)
|
||||||
|
|
||||||
print(f'Name: {response.data.fileInfo.name}')
|
print(f'Name: {response.data.file_info.name}')
|
||||||
print(f'Content Type: {response.data.fileInfo.contentType}')
|
print(f'Content Type: {response.data.fileInfo.content_type}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let info = client
|
||||||
|
.get_file_info(1, 6989, 89)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Name: {:?}", info.name);
|
||||||
|
println!("Content Type: {:?}", info.content_type);
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
info, _ := client.Files.GetInfo(
|
||||||
|
context.Background(),
|
||||||
|
1,
|
||||||
|
6989,
|
||||||
|
89,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("Name: %s\n", info.Name)
|
||||||
|
fmt.Printf("Content Type: %s\n", info.ContentType)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -58,13 +58,50 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.DeleteListItem(
|
response = client.delete_list_item(
|
||||||
listId=906,
|
list_id=906,
|
||||||
itemId='36f94d8c-2b9d-465e-9ad1-ede04109efc9'
|
itemId='36f94d8c-2b9d-465e-9ad1-ede04109efc9'
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Message: {response.message}')
|
print(f'Message: {response.message}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let item_id = Uuid::parse_str(
|
||||||
|
"e3371dbf-b557-4a31-b32f-33c0265d2a59"
|
||||||
|
)?;
|
||||||
|
|
||||||
|
client.delete_list_item(906, item_id).await?;
|
||||||
|
|
||||||
|
println!("List item deleted");
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
err := client.Lists.Delete(
|
||||||
|
context.Background(),
|
||||||
|
906,
|
||||||
|
"e3371dbf-b557-4a31-b32f-33c0265d2a59",
|
||||||
|
)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
fmt.Println("List item deleted")
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ console.log(itemId);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import ListItemRequest
|
from onspring_api_sdk.models import ListItemRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -76,17 +76,63 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = ListItemRequest(
|
request = ListItemRequest(
|
||||||
listId=906,
|
list_id=906,
|
||||||
name='Not Started',
|
name='Not Started',
|
||||||
id=None,
|
id=None,
|
||||||
numericValue=0,
|
numeric_value=0,
|
||||||
color='#ffffff'
|
color='#ffffff'
|
||||||
)
|
)
|
||||||
|
|
||||||
response = client.AddOrUpdateListItem(request)
|
response = client.add_or_update_list_item(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Id: {response.data.id}')
|
print(f'Id: {response.data.id}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, SaveListItemRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let request = SaveListItemRequest {
|
||||||
|
id: None,
|
||||||
|
name: "Not Started".to_string(),
|
||||||
|
numeric_value: Some(0.0),
|
||||||
|
color: Some("#ffffff".to_string()),
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.save_list_item(906, request)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Id: {}", response.id);
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
numericValue := 0.0
|
||||||
|
color := "#ffffff"
|
||||||
|
|
||||||
|
response, _ := client.Lists.Save(
|
||||||
|
context.Background(),
|
||||||
|
906,
|
||||||
|
onspring.SaveListItemRequest{
|
||||||
|
Name: "Not Started",
|
||||||
|
NumericValue: &numericValue,
|
||||||
|
Color: &color,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("Id: %s\n", response.Id)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,10 +52,42 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.DeleteRecordById(appId=195, recordId=140)
|
response = client.delete_record_by_id(app_id=195, recordId=140)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Message: {response.message}')
|
print(f'Message: {response.message}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
client.delete_record(195, 140).await?;
|
||||||
|
|
||||||
|
println!("Record deleted");
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
err := client.Records.Delete(
|
||||||
|
context.Background(),
|
||||||
|
195,
|
||||||
|
140,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
fmt.Println("Record deleted")
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import DeleteBatchRecordsRequest
|
from onspring_api_sdk.models import DeleteBatchRecordsRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -66,11 +66,50 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = DeleteBatchRecordsRequest(appId=195, recordIds=[138, 139])
|
request = DeleteBatchRecordsRequest(app_id=195, record_ids=[138, 139])
|
||||||
response = client.DeleteRecordsByIds(request)
|
response = client.delete_records_by_ids(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Message: {response.message}')
|
print(f'Message: {response.message}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, BatchDeleteRecordsRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let request = BatchDeleteRecordsRequest {
|
||||||
|
app_id: 195,
|
||||||
|
record_ids: vec![138, 139],
|
||||||
|
};
|
||||||
|
|
||||||
|
client.batch_delete_records(request).await?;
|
||||||
|
|
||||||
|
println!("Records deleted successfully");
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
err := client.Records.DeleteMany(
|
||||||
|
context.Background(),
|
||||||
|
onspring.DeleteManyRecordsRequest{
|
||||||
|
AppId: 195,
|
||||||
|
RecordIds: []int{138, 139},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
fmt.Println("Records deleted successfully")
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -52,22 +52,82 @@ console.log(record);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetRecordByIdRequest
|
from onspring_api_sdk.models import GetRecordByIdRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
request = GetRecordByIdRequest(appId=195, recordId=1)
|
request = GetRecordByIdRequest(appId=195, recordId=1)
|
||||||
|
|
||||||
response = client.GetRecordById(request)
|
response = client.get_record_by_id(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'AppId: {response.data.appId}')
|
print(f'AppId: {response.data.app_id}')
|
||||||
print(f'RecordId: {response.data.recordId}')
|
print(f'RecordId: {response.data.record_id}')
|
||||||
|
|
||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let record = client
|
||||||
|
.get_record(195, 1, None, None)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"AppId: {}, RecordId: {}",
|
||||||
|
record.app_id,
|
||||||
|
record.record_id
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Some(field_data) = record.field_data {
|
||||||
|
for field in field_data {
|
||||||
|
println!(
|
||||||
|
"FieldId: {}, Type: {:?}, Value: {}",
|
||||||
|
field.field_id,
|
||||||
|
field.value_type,
|
||||||
|
field.value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
record, _ := client.Records.Get(
|
||||||
|
context.Background(),
|
||||||
|
195,
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf(
|
||||||
|
"AppId: %d, RecordId: %d\n",
|
||||||
|
record.AppId,
|
||||||
|
record.RecordId,
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, field := range record.FieldData {
|
||||||
|
fmt.Printf(
|
||||||
|
"FieldId: %d, Type: %s, Value: %v\n",
|
||||||
|
field.FieldId,
|
||||||
|
field.Type,
|
||||||
|
field.Value,
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ for (const app of apps) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetRecordsByAppRequest
|
from onspring_api_sdk.models import GetRecordsByAppRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -53,22 +53,70 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = GetRecordsByAppRequest(appId=195)
|
request = GetRecordsByAppRequest(appId=195)
|
||||||
response = client.GetRecordsByAppId(request)
|
response = client.get_records_by_app_id(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for record in response.data.records:
|
for record in response.data.records:
|
||||||
print(f'AppId: {record.appId}')
|
print(f'AppId: {record.app_id}')
|
||||||
print(f'RecordId: {record.recordId}')
|
print(f'RecordId: {record.record_id}')
|
||||||
|
|
||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, PagingRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let paging = PagingRequest {
|
||||||
|
page_number: 1,
|
||||||
|
page_size: 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.list_records(195, Some(paging), None, None)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
for record in response.items.unwrap_or_default() {
|
||||||
|
println!(
|
||||||
|
"AppId: {}, RecordId: {}",
|
||||||
|
record.app_id,
|
||||||
|
record.record_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
page, _ := client.Records.List(
|
||||||
|
context.Background(),
|
||||||
|
195,
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, record := range page.Items {
|
||||||
|
fmt.Printf(
|
||||||
|
"AppId: %d, RecordId: %d\n",
|
||||||
|
record.AppId,
|
||||||
|
record.RecordId,
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ for (const record of records) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetBatchRecordsRequest
|
from onspring_api_sdk.models import GetBatchRecordsRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -80,24 +80,79 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = GetBatchRecordsRequest(
|
request = GetBatchRecordsRequest(
|
||||||
appId=195,
|
app_id=195,
|
||||||
recordIds=[1],
|
record_ids=[1],
|
||||||
fieldIds=[6983, 6986, 6987, 6985, 6984],
|
field_ids=[6983, 6986, 6987, 6985, 6984],
|
||||||
dataFormat='Raw'
|
data_format='Raw'
|
||||||
)
|
)
|
||||||
response = client.GetRecordsByIds(request)
|
response = client.get_records_by_ids(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Count: {response.data.count}')
|
print(f'Count: {response.data.count}')
|
||||||
|
|
||||||
for record in response.data.records:
|
for record in response.data.records:
|
||||||
print(f'AppId: {record.appId}')
|
print(f'AppId: {record.app_id}')
|
||||||
print(f'RecordId: {record.recordId}')
|
print(f'RecordId: {record.record_id}')
|
||||||
|
|
||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, BatchGetRecordsRequest, DataFormat};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let request = BatchGetRecordsRequest {
|
||||||
|
app_id: 195,
|
||||||
|
record_ids: vec![1],
|
||||||
|
field_ids: Some(vec![6983, 6986, 6987, 6985, 6984]),
|
||||||
|
data_format: Some(DataFormat::Raw),
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.batch_get_records(request)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
for record in response.items.unwrap_or_default() {
|
||||||
|
println!(
|
||||||
|
"AppId: {}, RecordId: {}",
|
||||||
|
record.app_id,
|
||||||
|
record.record_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
batch, _ := client.Records.GetMany(
|
||||||
|
context.Background(),
|
||||||
|
onspring.GetManyRecordsRequest{
|
||||||
|
AppId: 195,
|
||||||
|
RecordIds: []int{1},
|
||||||
|
FieldIds: []int{6983, 6986, 6987, 6985, 6984},
|
||||||
|
DataFormat: "Raw",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, record := range batch.Items {
|
||||||
|
fmt.Printf(
|
||||||
|
"AppId: %d, RecordId: %d\n",
|
||||||
|
record.AppId,
|
||||||
|
record.RecordId,
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ for (const record of records) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import QueryRecordsRequest
|
from onspring_api_sdk.models import QueryRecordsRequest
|
||||||
from OnspringApiSdk.Enums import DataFormat
|
from onspring_api_sdk.enums import DataFormat
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -102,28 +102,83 @@ operator = 'eq'
|
|||||||
value = '\'Test Task 5\''
|
value = '\'Test Task 5\''
|
||||||
|
|
||||||
request = QueryRecordsRequest(
|
request = QueryRecordsRequest(
|
||||||
appId=195,
|
app_id=195,
|
||||||
filter=f'{fieldId} {operator} {value}',
|
filter=f'{fieldId} {operator} {value}',
|
||||||
fieldIds=[6983, 6986, 6987, 6985, 6984],
|
field_ids=[6983, 6986, 6987, 6985, 6984],
|
||||||
dataFormat=DataFormat.Formatted.name,
|
data_format=DataFormat.Formatted.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
response = client.QueryRecords(request)
|
response = client.query_records(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for record in response.data.records:
|
for record in response.data.records:
|
||||||
print(f'AppId: {record.appId}')
|
print(f'AppId: {record.app_id}')
|
||||||
print(f'RecordId: {record.recordId}')
|
print(f'RecordId: {record.record_id}')
|
||||||
|
|
||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, QueryRecordsRequest, DataFormat};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let query = QueryRecordsRequest {
|
||||||
|
app_id: 195,
|
||||||
|
filter: "6983 eq 'Test Task 5'".to_string(),
|
||||||
|
field_ids: Some(vec![6983, 6986, 6987, 6985, 6984]),
|
||||||
|
data_format: Some(DataFormat::Formatted),
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.query_records(query, None)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
for record in response.items.unwrap_or_default() {
|
||||||
|
println!(
|
||||||
|
"AppId: {}, RecordId: {}",
|
||||||
|
record.app_id,
|
||||||
|
record.record_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
page, _ := client.Records.Query(
|
||||||
|
context.Background(),
|
||||||
|
onspring.QueryRecordsRequest{
|
||||||
|
AppId: 195,
|
||||||
|
Filter: "6983 eq 'Test Task 5'",
|
||||||
|
FieldIds: []int{6983, 6986, 6987, 6985, 6984},
|
||||||
|
DataFormat: "Formatted",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, record := range page.Items {
|
||||||
|
fmt.Printf(
|
||||||
|
"AppId: %d, RecordId: %d\n",
|
||||||
|
record.AppId,
|
||||||
|
record.RecordId,
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -87,40 +87,108 @@ console.log(newRecordId);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import StringFieldValue, GuidFieldValue, DateFieldValue, IntegerListValue, Record
|
from onspring_api_sdk.models import StringFieldValue, GuidFieldValue, DateFieldValue, IntegerListValue, Record
|
||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
|
cfg = ConfigParser()
|
||||||
|
cfg.read('config.ini')
|
||||||
|
|
||||||
|
key = cfg['prod']['key']
|
||||||
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
|
client = OnspringClient(url, key)
|
||||||
|
|
||||||
fields = []
|
fields = []
|
||||||
|
|
||||||
fields.append(StringFieldValue(6983, 'A New Test Task'))
|
fields.append(StringFieldValue(field_id=6983, value='A New Test Task'))
|
||||||
fields.append(StringFieldValue(6984, 'This is a test task.'))
|
fields.append(StringFieldValue(field_id=6984, value='This is a test task.'))
|
||||||
fields.append(
|
fields.append(
|
||||||
GuidFieldValue(
|
GuidFieldValue(field_id=6986, value=uuid.UUID('4118d53a-9121-4345-8682-07f23d606daa'))
|
||||||
6986,
|
|
||||||
uuid.UUID('4118d53a-9121-4345-8682-07f23d606daa')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
fields.append(
|
fields.append(
|
||||||
DateFieldValue(
|
DateFieldValue(field_id=6985, value=datetime(2021, 12, 25))
|
||||||
6985,
|
|
||||||
datetime.datetime(2021, 12, 25)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
fields.append(IntegerListValue(6987, [4]))
|
fields.append(IntegerListValue(field_id=6987, value=[4]))
|
||||||
|
|
||||||
record = Record(
|
record = Record(app_id=195, fields=fields)
|
||||||
appId=195,
|
|
||||||
fields
|
|
||||||
)
|
|
||||||
|
|
||||||
response = client.AddOrUpdateRecord(record)
|
response = client.add_or_update_record(record)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Id: {response.data.id}')
|
print(f'Id: {response.data.id}')
|
||||||
|
|
||||||
for warning in response.data.warnings:
|
for warning in response.data.warnings:
|
||||||
print(f'Warning: {warning}')
|
print(f'Warning: {warning}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, SaveRecordRequest};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut fields = HashMap::new();
|
||||||
|
fields.insert(
|
||||||
|
"6983".to_string(),
|
||||||
|
serde_json::json!("A New Test Task"),
|
||||||
|
);
|
||||||
|
fields.insert(
|
||||||
|
"6984".to_string(),
|
||||||
|
serde_json::json!("This is a test task."),
|
||||||
|
);
|
||||||
|
fields.insert(
|
||||||
|
"6985".to_string(),
|
||||||
|
serde_json::json!("12/25/2021"),
|
||||||
|
);
|
||||||
|
fields.insert(
|
||||||
|
"6986".to_string(),
|
||||||
|
serde_json::json!("4118d53a-9121-4345-8682-07f23d606daa"),
|
||||||
|
);
|
||||||
|
fields.insert(
|
||||||
|
"6987".to_string(),
|
||||||
|
serde_json::json!([4]),
|
||||||
|
);
|
||||||
|
|
||||||
|
let request = SaveRecordRequest {
|
||||||
|
app_id: 195,
|
||||||
|
record_id: None,
|
||||||
|
fields,
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client.save_record(request).await?;
|
||||||
|
|
||||||
|
println!("New Record Id is: {}", response.id);
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
response, _ := client.Records.Save(
|
||||||
|
context.Background(),
|
||||||
|
onspring.SaveRecordRequest{
|
||||||
|
AppId: 195,
|
||||||
|
Fields: map[string]any{
|
||||||
|
"6983": "A New Test Task",
|
||||||
|
"6984": "This is a test task.",
|
||||||
|
"6985": "12/25/2021",
|
||||||
|
"6986": "4118d53a-9121-4345-8682-07f23d606daa",
|
||||||
|
"6987": []int{4},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("New Record Id is: %d\n", response.Id)
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ console.log(report);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetReportByIdRequest
|
from onspring_api_sdk.models import GetReportByIdRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,16 +52,65 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = GetReportByIdRequest(reportId=613)
|
request = GetReportByIdRequest(report_id=613)
|
||||||
response = client.GetReportById(request)
|
response = client.get_report_by_id(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print('Columns:')
|
print('Columns:')
|
||||||
print(f'{", ".join(response.data.columns)}')
|
print(f'{", ".join(response.data.columns)}')
|
||||||
print('Rows:')
|
print('Rows:')
|
||||||
|
|
||||||
for row in response.data.rows:
|
for row in response.data.rows:
|
||||||
print(f'Record Id {row.recordId}: {", ".join([str(cell) for cell in row.cells])}')
|
print(f'Record Id {row.record_id}: {", ".join([str(cell) for cell in row.cells])}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::OnspringClient;
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let data = client
|
||||||
|
.get_report(613, None, None)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Columns: {:?}", data.columns);
|
||||||
|
|
||||||
|
if let Some(rows) = data.rows {
|
||||||
|
for row in rows {
|
||||||
|
println!(
|
||||||
|
"Record Id {:?}: {:?}",
|
||||||
|
row.record_id,
|
||||||
|
row.cells
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
data, _ := client.Reports.Get(
|
||||||
|
context.Background(),
|
||||||
|
613,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Printf("Columns: %v\n", data.Columns)
|
||||||
|
|
||||||
|
for _, row := range data.Rows {
|
||||||
|
fmt.Printf(
|
||||||
|
"Record Id %v: %v\n",
|
||||||
|
row.RecordId,
|
||||||
|
row.Cells,
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ for (const report of reports) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,16 +52,67 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetReportsByAppId(appId=195)
|
app_id = 195
|
||||||
|
response = client.get_reports_by_app_id(app_id=app_id)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'App Id: {appId}')
|
print(f'App Id: {app_id}')
|
||||||
print('Reports:')
|
print('Reports:')
|
||||||
|
|
||||||
for report in response.data.reports:
|
for report in response.data.reports:
|
||||||
print(f' Id: {report.id}')
|
print(f' Id: {report.id}')
|
||||||
print(f' Name: {report.name}')
|
print(f' Name: {report.name}')
|
||||||
print(f' Description: {report.description}')
|
print(f' Description: {report.description}')
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use onspring::{OnspringClient, PagingRequest};
|
||||||
|
|
||||||
|
let client = OnspringClient::builder(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let paging = PagingRequest {
|
||||||
|
page_number: 1,
|
||||||
|
page_size: 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.list_reports(195, Some(paging))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
for report in response.items.unwrap_or_default() {
|
||||||
|
println!(
|
||||||
|
"{}, {}, {}",
|
||||||
|
report.id,
|
||||||
|
report.app_id,
|
||||||
|
report.name.unwrap_or_default()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"
|
||||||
|
|
||||||
|
client := onspring.NewClient(
|
||||||
|
"000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
|
||||||
|
)
|
||||||
|
|
||||||
|
page, _ := client.Reports.List(
|
||||||
|
context.Background(),
|
||||||
|
195,
|
||||||
|
)
|
||||||
|
|
||||||
|
for _, report := range page.Items {
|
||||||
|
fmt.Printf(
|
||||||
|
"%d, %d, %s\n",
|
||||||
|
report.Id,
|
||||||
|
report.AppId,
|
||||||
|
report.Name,
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% /code %}
|
{% /code %}
|
||||||
|
|||||||
+21
-7
@@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "esnext",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
@@ -9,10 +13,10 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react-jsx",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
@@ -20,9 +24,19 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"]
|
"@/*": [
|
||||||
|
"./src/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": [
|
||||||
"exclude": ["node_modules"]
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts",
|
||||||
|
".next/dev/types/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user