fix(core): update

This commit is contained in:
Philipp Kunz 2024-05-02 16:07:25 +02:00
parent 5f54bd07d7
commit 62714c0166
5 changed files with 119 additions and 29 deletions

View File

@ -5,10 +5,17 @@
"githost": "code.foss.global",
"gitscope": "apiclient.xyz",
"gitrepo": "zitadel",
"description": "an unofficial zitadel client",
"description": "An unofficial client for interacting with Zitadel API.",
"npmPackagename": "@apiclient.xyz/zitadel",
"license": "MIT",
"projectDomain": "apiclient.xyz"
"projectDomain": "apiclient.xyz",
"keywords": [
"Zitadel",
"API client",
"TypeScript",
"authentication",
"user management"
]
}
},
"npmci": {

View File

@ -2,7 +2,7 @@
"name": "@apiclient.xyz/zitadel",
"version": "1.0.3",
"private": false,
"description": "an unofficial zitadel client",
"description": "An unofficial client for interacting with Zitadel API.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -48,5 +48,12 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"Zitadel",
"API client",
"TypeScript",
"authentication",
"user management"
]
}

0
readme.hints.md Normal file
View File

122
readme.md
View File

@ -1,31 +1,107 @@
# @apiclient.xyz/zitadel
an unofficial zitadel client
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@apiclient.xyz/zitadel)
* [gitlab.com (source)](https://code.foss.global/apiclient.xyz/zitadel)
* [github.com (source mirror)](https://github.com/apiclient.xyz/zitadel)
* [docs (typedoc)](https://apiclient.xyz.gitlab.io/zitadel/)
## Install
## Status for master
To install `@apiclient.xyz/zitadel`, you need to have Node.js installed on your system. You can then add it to your project using npm with the following command:
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://code.foss.global/apiclient.xyz/zitadel/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://code.foss.global/apiclient.xyz/zitadel/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@apiclient.xyz/zitadel)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/apiclient.xyz/zitadel)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiclient.xyz/zitadel)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiclient.xyz/zitadel)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiclient.xyz/zitadel)](https://lossless.cloud)
```bash
npm install @apiclient.xyz/zitadel --save
```
Ensure you have TypeScript installed for development purposes. If you haven't, install it using:
```bash
npm install -g typescript
```
## Usage
Use TypeScript for best in class intellisense
For further information read the linked docs at the top of this readme.
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
The `@apiclient.xyz/zitadel` package provides a simplified, unofficial TypeScript client for interacting with Zitadel's APIs. This guide will walk you through setting up the client and executing various operations such as user management in a TypeScript project.
Let's get started by setting up and initializing the client in your project.
### Setup and Initialization
First, import the necessary classes from the package:
```typescript
import { ZitaldelClient, ZitaldelUser } from '@apiclient.xyz/zitadel';
```
Instantiate the `ZitaldelClient` by providing connection options, including the Zitadel instance URL and an access token:
```typescript
const zitadelClient = new ZitaldelClient({
url: 'https://your-zitadel-instance.com', // Replace with your Zitadel instance URL
accessToken: 'your_access_token_here' // Replace with your actual access token
});
```
### Managing Users
The Zitadel client supports various user management operations such as listing users, getting user information, and creating new users.
#### Listing Users
To list users, you can use the `listUsers` method. This will return an array of `ZitaldelUser` objects:
```typescript
async function listUsers() {
try {
const users = await zitadelClient.listUsers();
console.log(users);
} catch (error) {
console.error('Failed to list users:', error);
}
}
listUsers();
```
#### Getting User Information
To get information about a specific user, use the `listOwnUser` method. This method is handy for fetching details about the authenticated user:
```typescript
async function getOwnUserInfo() {
try {
const user = await zitadelClient.listOwnUser();
console.log(user);
} catch (error) {
console.error('Failed to get user info:', error);
}
}
getOwnUserInfo();
```
#### Creating a User
To create a new user, the `createUser` method can be used. You need to provide user details such as email, first name, and last name:
```typescript
async function createUser() {
try {
await zitadelClient.createUser({
email: 'newuser@example.com',
firstName: 'John',
lastName: 'Doe'
});
console.log('User created successfully');
} catch (error) {
console.error('Failed to create user:', error);
}
}
createUser();
```
### Advanced Usage
For more advanced scenarios, refer to the [official Zitadel documentation](https://docs.zitadel.ch/) and the source code of this package. The `@apiclient.xyz/zitadel` client provides a straightforward interface to Zitadel's API but does not cover all possible use cases and functionalities of Zitadel. You might need to extend the client or use the official Zitadel client for complex scenarios.
## Conclusion
The `@apiclient.xyz/zitadel` package makes it easier to interact with Zitadel's APIs from a TypeScript application. With it, you can manage users, handle authentication, and perform various other operations provided by Zitadel. This guide covered the basics of setting up the client, managing users, and performing some common operations. For further details or specific use cases, consult the Zitadel documentation and the package's source code.
undefined

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiclient.xyz/zitadel',
version: '1.0.3',
description: 'an unofficial zitadel client'
version: '1.0.4',
description: 'An unofficial client for interacting with Zitadel API.'
}