Skip to content

add interface: create, delete field and create datasheet#22

Merged
shawndenggh merged 15 commits intovikadata:masterfrom
y-t99:master
May 24, 2022
Merged

add interface: create, delete field and create datasheet#22
shawndenggh merged 15 commits intovikadata:masterfrom
y-t99:master

Conversation

@y-t99
Copy link
Copy Markdown
Contributor

@y-t99 y-t99 commented May 5, 2022

add field.create, field.delete and datasheet.create interface and test example.

README.md Outdated
// add description to datasheet
request.setDescription("description");
// specify the folder where the datasheet is stored
request.setFolderId("fod_id");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fod_id——>fold_id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private void checkDeleteFieldPathArgs(String spaceId, String datasheetId, String fieldId) {
if (!StringUtil.hasText(spaceId)) {
throw new ApiException("space id must be not null");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be not null——> must not be null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md Outdated
.withProperty(singleTextFieldProperty)
.build();
// request to create a field
CreateFieldResponse response = vikaApiClient.getFieldApi().addField("space_id", "datasheet_id", request);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request object参数保持跟其他示例统一名字:xxxxRequest,比如createFieldRequest。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md Outdated
request.setFields(fields);

// request to create a datasheet
CreateDatasheetResponse response = vikaApiClient.getDatasheetApi().addDatasheet("space_id", request);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request object参数保持跟其他示例统一名字:xxxxRequest,比如createDatasheetRequest。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public class MagicLinkFieldProperty extends BaseFieldProperty {

private String foreignDatasheetId;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除多于换行

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Format about Currency
* @see cn.vika.client.api.model.field.property.option.CurrencyFormat
*/
Currency("Currency"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* @author tao
*/
public abstract class TypeFormat {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeFormat这个抽象类什么参数都没有,它存在的意义是什么?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* @author tao
*/
public enum TimeFormatEnum {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有的枚举命名以Enum结尾,有的没有,需要统一

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -49,6 +49,10 @@ public class VikaApiClient {

private NodeApi nodeApi;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

赞!双重检查锁定模式需要需要使用 volatile,之前用到双重锁的地方也加上volatile吧。解决两个问题:

保证可见性。使用 volatile 定义的变量,将会保证对所有线程的可见性
禁止指令重排序优化

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md Outdated
> more detail about field type and property of field see official [API manual#create-field](https://vika.cn/developers/api/reference/#operation/create-fields)

```java
// Example 1: create SingleText field
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个Example拆分成两个代码块,参考update record的两个Example

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*/
public enum FieldTypeEnum {
/**
*
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加下注释

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

@shawndenggh shawndenggh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished

Copy link
Copy Markdown
Contributor

@shawndenggh shawndenggh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewed

@shawndenggh shawndenggh merged commit e26f90e into vikadata:master May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants