nimSdk

package
v0.0.0-...-f412cee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

* The MIT License (MIT) * * Copyright (c) 2016 tony<wuhaiyang1213@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software.

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

* The MIT License (MIT) * * Copyright (c) 2016 tony<wuhaiyang1213@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software.

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

* The MIT License (MIT) * * Copyright (c) 2016 tony<wuhaiyang1213@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software.

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

* The MIT License (MIT) * * Copyright (c) 2016 tony<wuhaiyang1213@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software.

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

* The MIT License (MIT) * * Copyright (c) 2016 tony<wuhaiyang1213@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software.

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

Index

Constants

View Source
const NETEASE_BASE_URL = "https://api.netease.im/nimserver"

Variables

View Source
var APPKEY = ""
View Source
var APPSECRETKEY = ""
View Source
var BLOCK_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/block.action"}
View Source
var CREATE_ACCOUNT_ID_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/create.action"}
View Source
var FRIENDSHIP_URL = UrlPair{"POST", NETEASE_BASE_URL + "/friend/add.action"}
View Source
var GET_PROFILE_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/getUinfos.action"}
View Source
var REFRESH_TOKEN_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/refreshToken.action"}
View Source
var SPECIALRELATION_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/setSpecialRelation.action"}
View Source
var UNBLOCK_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/unblock.action"}
View Source
var UPDATE_ACCOUNT_ID_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/update.action"}
View Source
var UPDATE_PROFILE_URL = UrlPair{"POST", NETEASE_BASE_URL + "/user/updateUinfo.action"}

Functions

func AddNeteaseHttpHeader

func AddNeteaseHttpHeader(req *http.Request)

在HttpHeader中添加参数用于校验

func Block

func Block(accid string) (string, error)

封禁云信ID 第三方禁用某个云信ID的IM功能,封禁云信ID后,此ID将不能登陆云信imserver accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一

func DoNeteaseHttpRequest

func DoNeteaseHttpRequest(v url.Values, reqMethod string, reqUrl string) (string, error)

执行云信http请求

func GetCheckSum

func GetCheckSum(appSecret string, nonce string, curTime string) string

func Init

func Init(appKey string, appSecretKey string)

func RefreshToken

func RefreshToken(accid string) (string, error)

更新并获取新token WebServer更新云信ID的token,同时返回新的token accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一

func Unblock

func Unblock(accid string) (string, error)

解禁云信ID 解禁被封禁的云信ID accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一

func UpdateAccid

func UpdateAccid(accid string, name string, props string, icon string, token string) (string, error)

云信ID更新 云信ID基本信息更新 accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一(只允许字母、数字、半角下划线_、@、半角点以及半角-组成, 不区分大小写, 会统一小写处理,请注意以此接口返回结果中的accid为准) name string 云信ID昵称,最大长度64字节,用来PUSH推送 时显示的昵称 props string json属性,第三方可选填,最大长度1024字节 icon string 云信ID头像URL,第三方可选填,最大长度1024 token string 云信ID可以指定登录token值,最大长度128字节, 并更新,如果未指定,会自动生成token,并在创建成功后返回

func UpdateProfile

func UpdateProfile(accid string, name string, icon string, sign string, email string, birth string, mobile string, gender string, ex string) (bool, error)

更新用户名片 accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一 name string 用户昵称,最大长度64字节 icon string 用户icon,最大长度1024字节 sign string 用户签名,最大长度256字节 email string 用户email,最大长度64字节 birth string 用户生日,最大长度16字节 mobile string 用户mobile,最大长度32字节 gender string 用户性别,0表示未知,1表示男,2女表示女,其它会报参数错误 ex string 用户名片扩展字段,最大长度1024字节,用户可自行扩展,建议封装成JSON字符串

Types

type NIMGetProfileResp

type NIMGetProfileResp struct {
	NetEaseResp
	Uinfos []NIMUserProfile
}

type NIMUInfo

type NIMUInfo struct {
	Accid string //云信ID
	Name  string //云信ID昵称,最大长度64字节,用来PUSH推送时显示的昵称
	Icon  string //云信ID头像URL,第三方可选填,最大长度1024
	Token string //token
}

func CreateAccid

func CreateAccid(accid string, name string, props string, icon string, token string) (*NIMUInfo, error)

创建云信ID 第三方帐号导入到云信平台 accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一(只允许字母、数字、半角下划线_、@、半角点以及半角-组成, 不区分大小写, 会统一小写处理,请注意以此接口返回结果中的accid为准) name string 云信ID昵称,最大长度64字节,用来PUSH推送 时显示的昵称 props string json属性,第三方可选填,最大长度1024字节 icon string 云信ID头像URL,第三方可选填,最大长度1024 token string 云信ID可以指定登录token值,最大长度128字节, 并更新,如果未指定,会自动生成token,并在创建成功后返回

type NIMUserProfile

type NIMUserProfile struct {
	NIMUInfo
	Sign   string //用户签名,最大长度256字节
	Emai   string //用户email,最大长度64字节
	Birth  string //用户生日,最大长度16字节
	Mobile string //用户mobile,最大长度32字节,只支持国内号码
	Gender int    //用户性别,0表示未知,1表示男,2女表示女,其它会报参数错误
	Ex     string //用户名片扩展字段,最大长度1024字节,用户可自行扩展,建议封装成JSON字符串
}

func GetProfile

func GetProfile(accids []string) ([]NIMUserProfile, error)

获取用户名片 获取用户名片,可批量 accId string 云信ID,最大长度32字节,必须保证一个 APP内唯一

type NetEaseResp

type NetEaseResp struct {
	Code int //状态码
}

type UrlPair

type UrlPair struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL