• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang aerofsapi.Client类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/aerofs/aerofs-sdk-golang/aerofsapi.Client的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Client类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: NewDeviceClient

// Return an existing device client given a deviceId
func NewDeviceClient(c *api.Client, deviceId string) (*DeviceClient, error) {
	body, _, err := c.GetDeviceMetadata(deviceId)
	if err != nil {
		return nil, err
	}
	device := Device{}
	err = json.Unmarshal(body, &device)
	return &DeviceClient{c, device}, err
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:10,代码来源:device.go


示例2: ListSharedFolders

// Retrieve a list of SharedFolder member descriptors
// TODO : Should an Etag be return for each one?
func ListSharedFolders(c *api.Client, sid string, etags []string) ([]SharedFolder, error) {
	body, _, err := c.ListSharedFolders(sid, etags)
	if err != nil {
		return nil, err
	}
	sfs := []SharedFolder{}
	err = json.Unmarshal(body, &sfs)
	if err != nil {
		return nil, errors.New("Unable to demarshal the list of retrieved SharedFolders")
	}
	return sfs, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:14,代码来源:sf.go


示例3: ListGroups

// List all groups
func ListGroups(c *api.Client, offset, results int) (*[]Group, error) {
	body, _, err := c.ListGroups(offset, results)
	if err != nil {
		return nil, err
	}
	groups := []Group{}
	err = json.Unmarshal(body, &groups)
	if err != nil {
		return nil, errors.New("Unable to unmarshal list of groups")
	}

	return &groups, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:14,代码来源:group.go


示例4: GetSFMemberClient

// Return an existing SFMemberClient given its shared folder and user email
func GetSFMemberClient(c *api.Client, sid, email string, etags []string) (*SFMemberClient, error) {
	body, header, err := c.GetSFMember(sid, email, etags)
	if err != nil {
		return nil, err
	}
	sfmClient := SFMemberClient{APIClient: c, Etag: header.Get("ETag"), Desc: SFMember{Sid: sid, Email: email}}
	err = json.Unmarshal(body, &sfmClient.Desc)
	if err != nil {
		return nil, errors.New("Unable to unmarshal retrieved SFMember")
	}

	return &sfmClient, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:14,代码来源:sfmember.go


示例5: ListDevices

// Retrieve a list of existing Device descriptors
func ListDevices(c *api.Client, email string) ([]Device, error) {
	body, _, err := c.ListDevices(email)
	if err != nil {
		return nil, err
	}

	devices := []Device{}
	err = json.Unmarshal(body, &devices)
	if err != nil {
		return nil, errors.New("Unable to demarshal list of devices")
	}
	return devices, err
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:14,代码来源:device.go


示例6: GetSharedFolderClient

// Retrieve an existing shared folder
func GetSharedFolderClient(c *api.Client, sid string, etags []string) (*SharedFolderClient, error) {
	body, header, err := c.ListSharedFolderMetadata(sid, etags)
	if err != nil {
		return nil, err
	}
	sfClient := SharedFolderClient{APIClient: c}
	err = json.Unmarshal(body, &sfClient.Desc)
	if err != nil {
		return nil, errors.New("Unable to unmarshal retrieved Shared Folder")
	}
	sfClient.Etag = header.Get("ETag")
	return &sfClient, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:14,代码来源:sf.go


示例7: ListUsers

// Get a list of existing user descriptors
func ListUsers(client *api.Client, limit int) (*[]User, error) {
	body, _, err := client.ListUsers(limit, nil, nil)
	if err != nil {
		return nil, err
	}

	userResp := userListResponse{}
	err = json.Unmarshal(body, &userResp)
	if err != nil {
		return nil, errors.New("Unable to unmarshal a retrieved list of users")
	}
	return &userResp.Users, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:14,代码来源:user.go


示例8: CreateGroupClient

// Create a group
func CreateGroupClient(c *api.Client, groupName string) (*GroupClient, error) {
	body, _, err := c.CreateGroup(groupName)
	if err != nil {
		return nil, err
	}

	g := GroupClient{APIClient: c}
	err = json.Unmarshal(body, &g.Desc)
	if err != nil {
		return nil, errors.New("Unable to unmarshal created group")
	}

	return &g, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:15,代码来源:group.go


示例9: NewGroupClient

// Retrieve an existing group
func NewGroupClient(c *api.Client, groupId string) (*GroupClient, error) {
	body, _, err := c.GetGroup(groupId)
	if err != nil {
		return nil, err
	}

	g := GroupClient{APIClient: c}
	err = json.Unmarshal(body, &g.Desc)
	if err != nil {
		return nil, errors.New("Unable to unmarshal existing group")
	}

	return &g, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:15,代码来源:group.go


示例10: CreateSharedFolderClient

// Create a new shared folder and return a client associated with it
func CreateSharedFolderClient(c *api.Client, name string) (*SharedFolderClient, error) {
	body, _, err := c.CreateSharedFolder(name)
	if err != nil {
		return nil, err
	}

	sfClient := SharedFolderClient{APIClient: c}
	err = json.Unmarshal(body, &sfClient.Desc)
	if err != nil {
		return nil, errors.New("Unable to unmarshal retrieved SharedFolder")
	}

	return &sfClient, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:15,代码来源:sf.go


示例11: CreateUserClient

// Create a new user and return a UserClient tied to the APIClient argument
func CreateUserClient(client *api.Client, email, firstName, lastName string) (*UserClient, error) {
	body, _, err := client.CreateUser(email, firstName, lastName)
	if err != nil {
		return nil, err
	}

	u := User{}
	err = json.Unmarshal(body, &u)
	if err != nil {
		return nil, errors.New("Unable to unmarshal new User")
	}

	return &UserClient{client, u}, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:15,代码来源:user.go


示例12: ListSFMember

// Retrieve a list of SharedFolder member descriptors
// TOD : Should an Etag be return for each one?
func ListSFMember(c *api.Client, sid string, etags []string) ([]SFMember, error) {
	body, _, err := c.ListSFMembers(sid, etags)
	if err != nil {
		return nil, err
	}
	sfmembers := []SFMember{}
	err = json.Unmarshal(body, &sfmembers)
	if err != nil {
		return nil, errors.New("Unable to demarshal the list of retrieved SharedFolder members")
	}
	for _, v := range sfmembers {
		v.Sid = sid
	}
	return sfmembers, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:17,代码来源:sfmember.go


示例13: NewFileClient

// Construct a FileClient given a file identifier and APIClient
func NewFileClient(c *api.Client, fileId string, fields []string) (*FileClient, error) {
	body, header, err := c.GetFileMetadata(fileId, fields)
	if err != nil {
		return nil, err
	}

	f := FileClient{APIClient: c, OnDemand: fields}
	err = json.Unmarshal(body, &f.Desc)

	if err != nil {
		return nil, errors.New("Unable to unmarshal existing File")
	}
	f.Desc.Etag = header.Get("ETag")
	return &f, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:16,代码来源:file.go


示例14: GetUserClient

// Given an existing user's email, return a client for said user
func GetUserClient(client *api.Client, email string) (*UserClient, error) {
	body, _, err := client.GetUser(email)
	if err != nil {
		return nil, err
	}

	u := UserClient{APIClient: client}
	err = json.Unmarshal(body, &u.Desc)
	if err != nil {
		fmt.Println(err)
		return nil, errors.New("Unable to unmarshal new User")
	}

	return &u, nil
}
开发者ID:aerofs,项目名称:aerofs-sdk-golang,代码行数:16,代码来源:user.go



注:本文中的github.com/aerofs/aerofs-sdk-golang/aerofsapi.Client类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang aerospike-client-go.NewBin函数代码示例发布时间:2022-05-24
下一篇:
Golang system.System类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap