Skip to content

Commit

Permalink
feat: add document
Browse files Browse the repository at this point in the history
  • Loading branch information
YunzhiYike committed Apr 3, 2024
1 parent 7339598 commit 72fc428
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 15 deletions.
62 changes: 55 additions & 7 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,63 @@
# 非官方 Suno PHP-SDK
这是一个基于 PHP 的非官方 Suno API;它为所有 Suno 接口提供支持。

## 安装
## 安装 🔨

```bash
composer require yunzhiyike/suno-ai-sdk
```

## 方法
-[x] `generateMusic` > [说明: 生成音乐, 返回 `uid` ]
-[x] `refreshSession` > [说明: 延长会话时间, 返回 `PersonalInfoEntity` ]
-[x] `getUserInfoByEmail` > [说明: 通过电子邮件获取用户信息, 返回 `PersonalInfoEntity` ]
-[x] `getWorkList` > [说明:获取生成的音乐列表, 返回 `WorkEntity[]` ]
-[x] `getAvailableTimes` > [说明: 获取可用次数, 返回 `int` ]
## 方法 📖

- [x] `generateMusic` [说明: 生成音乐, 返回 `uid` ]
- [x] `refreshSession` [说明: 延长会话时间, 返回 `PersonalInfoEntity` ]
- [x] `getUserInfoByEmail` [说明: 通过电子邮件获取用户信息, 返回 `PersonalInfoEntity` ]
- [x] `getWorkList` [说明:获取生成的音乐列表, 返回 `WorkEntity[]` ]
- [x] `getAvailableTimes` [说明: 获取可用次数, 返回 `int` ]


## Cookie提取 🚗

> 在此之前你需要先登录!
![img_1.png](img_1.png)


## 示例 🌲
```php
<?php

declare(strict_types=1);
/**
* This file is part of Yunzhiyike
*/

namespace Yunzhiyike\Test;

use PHPUnit\Framework\TestCase;
use Yunzhiyike\SunoAiSdk\SunoAi;

/**
* @internal
* @coversNothing
*/
class SunoAiTest extends TestCase
{
public function test()
{
$cookie = 'your suno-ai cookie';
$timeOut = 60;
$sunoApi = new SunoAi($cookie, $timeOut);
$info = $sunoApi->refreshSession();
$userInfo = $sunoApi->getUserInfoByEmail($info->getEmail());
$page = 1;
$res = $sunoApi->getWorkList($userInfo->getUserId(), $page);
foreach ($res as $r) {
var_dump($r);
}
var_dump($sunoApi->getAvailableTimes($userInfo->getUserId()));
var_dump($sunoApi->generateMusic($userInfo->getUserId(), 'music title', 'music text', 'music tags', true));
}
}

```
58 changes: 53 additions & 5 deletions README-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,56 @@ composer require yunzhiyike/suno-ai-sdk
```

## メソッド
-[x] `generateMusic` > [記述: ジェネレート・ミュージック, 戻る, `uid` ]
-[x] `refreshSession` > [記述: セッション生存時間の延長, 戻る `PersonalInfoEntity` ]
-[x] `getUserInfoByEmail` > [記述: 電子メールによるユーザー情報の取得, 戻る `PersonalInfoEntity` ]
-[x] `getWorkList` > [記述: 生成された楽曲リストの取得, 戻る `WorkEntity[]` ]
-[x] `getAvailableTimes` > [記述: 利用可能回数取得, 戻る `int` ]

- [x] `generateMusic` [記述: ジェネレート・ミュージック, 戻る, `uid` ]
- [x] `refreshSession` [記述: セッション生存時間の延長, 戻る `PersonalInfoEntity` ]
- [x] `getUserInfoByEmail` [記述: 電子メールによるユーザー情報の取得, 戻る `PersonalInfoEntity` ]
- [x] `getWorkList` [記述: 生成された楽曲リストの取得, 戻る `WorkEntity[]` ]
- [x] `getAvailableTimes` [記述: 利用可能回数取得, 戻る `int` ]


## Cookie 引き出す 🚗

> 在此之前你需要先登录!
![img_1.png](img_1.png)


## 典型例 🌲
```php
<?php

declare(strict_types=1);
/**
* This file is part of Yunzhiyike
*/

namespace Yunzhiyike\Test;

use PHPUnit\Framework\TestCase;
use Yunzhiyike\SunoAiSdk\SunoAi;

/**
* @internal
* @coversNothing
*/
class SunoAiTest extends TestCase
{
public function test()
{
$cookie = 'your suno-ai cookie';
$timeOut = 60;
$sunoApi = new SunoAi($cookie, $timeOut);
$info = $sunoApi->refreshSession();
$userInfo = $sunoApi->getUserInfoByEmail($info->getEmail());
$page = 1;
$res = $sunoApi->getWorkList($userInfo->getUserId(), $page);
foreach ($res as $r) {
var_dump($r);
}
var_dump($sunoApi->getAvailableTimes($userInfo->getUserId()));
var_dump($sunoApi->generateMusic($userInfo->getUserId(), 'music title', 'music text', 'music tags', true));
}
}

```
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,63 @@ English | [中文](./README-CN.md) | [日本語](./README-JP.md)
# Unofficial Suno PHP-SDK
This is an unofficial Suno API based on PHP; it provides support for all Suno interfaces.

## Installation
## Installation 🔨

```bash
composer require yunzhiyike/suno-ai-sdk
```

## Methods
## Methods 📖

- [x] `generateMusic` [description: generate music, return `uid` ]

- [x] `refreshSession` [description: Increase session survival time, return `PersonalInfoEntity` ]
- [x] `getUserInfoByEmail` [description: Obtaining user information via e-mail, return `PersonalInfoEntity` ]
- [x] `getWorkList` [description: Obtaining generated music list, return `WorkEntity[]` ]
- [x] `getAvailableTimes` [description: Getting the number of times available, return `int` ]


## Cookie Extraction 🚗

> Before that you need to login!
![img_1.png](img_1.png)


## Demo 🌲
```php
<?php

declare(strict_types=1);
/**
* This file is part of Yunzhiyike
*/

namespace Yunzhiyike\Test;

use PHPUnit\Framework\TestCase;
use Yunzhiyike\SunoAiSdk\SunoAi;

/**
* @internal
* @coversNothing
*/
class SunoAiTest extends TestCase
{
public function test()
{
$cookie = 'your suno-ai cookie';
$timeOut = 60;
$sunoApi = new SunoAi($cookie, $timeOut);
$info = $sunoApi->refreshSession();
$userInfo = $sunoApi->getUserInfoByEmail($info->getEmail());
$page = 1;
$res = $sunoApi->getWorkList($userInfo->getUserId(), $page);
foreach ($res as $r) {
var_dump($r);
}
var_dump($sunoApi->getAvailableTimes($userInfo->getUserId()));
var_dump($sunoApi->generateMusic($userInfo->getUserId(), 'music title', 'music text', 'music tags', true));
}
}

```
Binary file added img_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72fc428

Please sign in to comment.