WeChat API Documentation

BaseReq

public

Base class of all request classes of WeChat SDK.

Import WXApiObject.h;

property

(int) type

int BaseReq::type

Request type

(NSString *) openID

NSString* BaseReq::openID

The unique identifier, comprised of a user’s
WeChat ID and App ID, must be filled by developers while sending a
request. The purpose is to check whether the user has logged in with
another account.

BaseResp

public

Base class of all response classes of WeChat SDK.

Import WXApiObject.h;

property

(int) errCode

int BaseResp::errCode

Error code

(NSString *) errStr

NSString* BaseResp::errStr

Error notification string

(int) type

int BaseResp::type

Response type

GetMessageFromWXReq

public

Message structure that the third-party application uses to request authorization from WeChat.

Import WXApiObject.h;

The third-party app requests for verification and authorization by calling sendReq member function of WXApi. WeChat will return a result after processing.

GetMessageFromWXResp

public

Message structure that the third-party application uses to response requests from WeChat.

Import WXApiObject.h;

WeChat sends a request to a third-party application; and the third-party application calls sendResp to return the result in a GetMessageFromWXResp message.

property

(NSString *) text

NSString* GetMessageFromWXResp::text

Text contents provided to WeChat

(WXMediaMessage *) message

WXMediaMessage* GetMessageFromWXResp::message

Multi-media contents provided to WeChat

(BOOL) bText

BOOL GetMessageFromWXResp::bText

Types of message that providing contents to WeChat. It could be text or multi-media but not both.

LaunchFromWXReq

public

The message structure carried by WeChat client when a third-party application is opened.

Import WXApiObject.h;

This is the WeChat’s data structure sent to a third party. No return value expected from the third party.

SendMessageToWXReq

public

Message structure that the third-party application uses to send message to WeChat.

Import WXApiObject.h;

The third-party app uses SendMessageToWXReq
to send messages to WeChat. The message type can be text (member: text)
and multi-media (member: message). WeChat will then return the result
after processing.

property

(NSString *) text

NSString* SendMessageToWXReq::text

Text contents in the message sent

(WXMediaMessage *) message

WXMediaMessage* SendMessageToWXReq::message

Multi-media contents in the message sent

(BOOL) bText

BOOL SendMessageToWXReq::bText

The message type can be Text or Multi-media but not both.

(int) scene

int SendMessageToWXReq::scene

Target scene, you can send to contact or moments. Contact if default choice.

SendMessageToWXResp

public

Result of SendMessageToWXReq that WeChat returns to the third-party app.

Import WXApiObject.h;

Wechat uses SendMessageToWXResp to return results of SendMessageToWXReq from the third-party app.

ShowMessageFromWXReq

public

WeChat asks the third-party to show contents.

Import WXApiObject.h;

WeChat sends an ShowMessageFromWXReq message to ask the third-party app to show certain contents. And the third-party app calls sendResp to send an ShowMessageFromWXResp message to WeChat after processing.

property

(WXMediaMessage *) message

WXMediaMessage* ShowMessageFromWXReq::message

WeChat asks the third-party to show contents

ShowMessageFromWXResp

public

WeChat sends an ShowMessageFromWXReq message to ask the third-party app to show certain contents. And the third-party app calls sendResp to send an ShowMessageFromWXResp message to WeChat after processing.

Import WXApiObject.h;

WXApi

public

WeChat API interface functions.

Import WXApi.h;

This class envelopes all interfaces of WeChat SDK

function

(BOOL) registerApp

Member function of WXApi. It‘s used to register the third-party app in WeChat.

BOOL WXApi::registerApp: (NSString *appid)

It should be called whenever WeChat enables the third-party app. The app will appear in Available Apps in WeChat.

Params:


appid
  WeChat Developer ID  

Returns:

Yes (success) or No (failure)

(BOOL) registerApp:withDescription

A member function of WXApi, used for the application registration of third parties in WeChat client program.

BOOL WXApi::registerApp:withDescription: (NSString *appid,[withDescription] NSString *appdesc)

Needs to be called when a third-party application
starts each time. It will show in the list of available applications on
WeChat after the first call.

Params:


appid
  WeChat developer ID  

appdesc
  Additional application description, no longer than 1024 bytes  

Returns:

Return ‘YES’ if success, otherwise return ‘NO’.

(BOOL) handleOpenURL:delegate

Process the data transferred while WeChat enable the app through URL.

BOOL WXApi::handleOpenURL:delegate: (NSURL *url,[delegate] id< WXApiDelegate > delegate)

Call in application:openURL:sourceApplication:annotation: or application:handleOpenURL

Params:


url
  URL used to enable the app  

delegate
  Object of WXApiDelegate. It‘s used to receive messages that trigger WeChat  

Returns:

Yes (success) or No (failure)

(BOOL) isWXAppInstalled

Check whether the user has installed WeChat.

BOOL WXApi::isWXAppInstalled ()

Returns:

Yes (WeChat installed) or No (WeChat not installed)

(BOOL) isWXAppSupportApi

Check whether the current WeChat version supports OpenApi.

BOOL WXApi::isWXAppSupportApi ()

Returns:

Yes (support) or No (do not support)

(NSString *) getApiVersion

Get the current SDK version.

NSString * WXApi::getApiVersion ()

Returns:

the current SDK version

(NSString *) getWXAppInstallUrl

Get installation URL of WeChat in iTunes.

NSString * WXApi::getWXAppInstallUrl ()

Returns:

strings about installation URL of WeChat

(BOOL) openWXApp

Open WeChat.

BOOL WXApi::openWXApp ()

Returns:

Yes (success) or No (failure)

(BOOL) sendReq

Send a request to WeChat and wait for onResp returned from WeChat.

BOOL WXApi::sendReq: (BaseReq *req)

The third-party app calls this function, switches
to WeChat interface and waits for onResp returned from WeChat. WeChat
must calls onResp after the asynchronous processing. Possible requests
include SendMessageToWXReq, etc.

Params:


req
  Specific request. It should be auto-released after calling the function.  

Returns:

Yes (success) or No (failure)

(BOOL) sendResp

Send the response of onReq request from WeChat and go to WeChat interface.

BOOL WXApi::sendResp: (BaseResp *resp)

When this function is called, WeChat interface is
open. The third-party app receives onResp request from WeChat, processes
this request asynchronously and calls this function. Possible requests
include GetMessageFromWXResp, ShowMessageFromWXResp, etc.

Params:


resp
  Specific response. It should be auto-released after calling the function.  

Returns:

Yes (success) or No (failure)

WXAppExtendObject

public

App extend object included in multi-media messages.

Import WXApiObject.h;

The third-party app sends a multi-media message that includes WXAppExtendObject to WeChat. WeChat calls this app to process the multi-media contents.

property

(NSString *) url

NSString* WXAppExtendObject::url

If the third-party app does not exist, WeChat will open the download URL of the app.

(NSString *) extInfo

NSString* WXAppExtendObject::extInfo

Custom data of the third-party app. WeChat will return it to the app for processing.

(NSData *) fileData

NSData* WXAppExtendObject::fileData

App file data. When this data is sent to WeChat
contacts, the contact needs to click to download. WeChat then returns it
to the app for processing.

function

(WXAppExtendObject *) object

Return a WXAppExtendObject object.

WXAppExtendObject * WXAppExtendObject::object ()

WXEmoticonObject

public

Emoticon object included in multi-media messages transferred between WeChat and the third-party app.

Import WXApiObject.h;

property

(NSData *) emoticonData

NSData* WXEmoticonObject::emoticonData

The content of emoticon

function

(WXEmoticonObject *) object

Return a WXEmoticonObject object.

WXEmoticonObject * WXEmoticonObject::object ()

WXFileObject

public

todo

Import WXApiObject.h;

property

(NSString *) fileExtension

NSString* WXFileObject::fileExtension

File Extensions

(NSData *) fileData

NSData* WXFileObject::fileData

File content

function

(WXFileObject *) object

Returns a WXFileObject object.

WXFileObject * WXFileObject::object ()

WXImageObject

public

Image object included in multi-media messages.

Import WXApiObject.h;

The image object included in the message transferred between WeChat and the third-party app

property

(NSData *) imageData

NSData* WXImageObject::imageData

Actual contents of the image

(NSString *) imageUrl

NSString* WXImageObject::imageUrl

Image URL

function

(WXImageObject *) object

Return a WXImageObject object.

WXImageObject * WXImageObject::object ()

WXMediaMessage

public

Import WXApiObject.h;

Multi-media contents in the message sent

property

(NSString *) title

NSString* WXMediaMessage::title

Title

(NSString *) description

NSString* WXMediaMessage::description

Description

(NSData *) thumbData

NSData* WXMediaMessage::thumbData

Data of the thumb

(NSString *) mediaTagName

NSString* WXMediaMessage::mediaTagName

todo

(id) mediaObject

id WXMediaMessage::mediaObject

Multi-media data object, including WXWebpageObject, WXImageObject, WXMusicObject, etc.

function

(WXMediaMessage *) message

WXMediaMessage * WXMediaMessage::message ()

(void) setThumbImage

Method used to set the thumb of image message.

void WXMediaMessage::setThumbImage: (UIImage *image)

Params:


image
  Thumb  

WXMusicObject

public

Music object included in multi-media messages.

Import WXApiObject.h;

Music object included in the message transferred between WeChat and the third-party app

property

(NSString *) musicUrl

NSString* WXMusicObject::musicUrl

URL of music webpage

(NSString *) musicLowBandUrl

NSString* WXMusicObject::musicLowBandUrl

URL of music lowband webpage

(NSString *) musicDataUrl

NSString* WXMusicObject::musicDataUrl

URL of music data

(NSString *) musicLowBandDataUrl

NSString* WXMusicObject::musicLowBandDataUrl

URL of lowband data of the music

function

(WXMusicObject *) object

Return a WXMusicObject object.

WXMusicObject * WXMusicObject::object ()

WXVideoObject

public

Video object included in multi-media messages.

Import WXApiObject.h;

Video object included in the message transferred between WeChat and the third-party app

property

(NSString *) videoUrl

NSString* WXVideoObject::videoUrl

URL of video data

(NSString *) videoLowBandUrl

NSString* WXVideoObject::videoLowBandUrl

URL of video lowband data

function

(WXVideoObject *) object

Returns a WXVideoObject object.

WXVideoObject * WXVideoObject::object ()

WXWebpageObject

public

Webpage object included in multi-media messages.

Import WXApiObject.h;

Webpage object included in the multi-media message transferred between WeChat and the third-party app

property

(NSString *) webpageUrl

NSString* WXWebpageObject::webpageUrl

URL of the webpage

function

(WXWebpageObject *) object

Return a WXWebpageObject object.

WXWebpageObject * WXWebpageObject::object ()

WXApiDelegate-p

public

Receive and process event messages from WeChat.

Import WXApi.h;

Receive and process event messages from WeChat. Meanwhile WeChat will switch to the third-party app. WXApiDelegate is used and triggered in handleOpenURL.

function

(void) onReq

Receive and process request from WeChat and call sendResp.

void WXApiDelegate-p::onReq: (BaseReq *req)

The third-party app receives a request from
WeChat. After asynchronous processing of the request. sendResp should be
called to send the result to WeChat. Possible requests include GetMessageFromWXReq, ShowMessageFromWXReq, etc.

Params:


req
  Specific request contents (auto-released)  

(void) onResp

Response of sendReq from WeChat.

void WXApiDelegate-p::onResp: (BaseResp *resp)

The third-party app receives the result from WeChat. If sendReq is called, onResp will be received. Possible results include SendMessageToWXResp, etc.

Params:


Specific
  response contents (auto-released)  
时间: 2024-11-29 00:31:01

WeChat API Documentation的相关文章

Can&#39;t generate API documentation in l5-swagger

Can't generate API documentation in l5-swagger Ask Question Asked 3 months ago Active 1 month ago Viewed 286 times 0 I'm starting to study swagger. I'm trying to do the same which is done in book "Hands-On Full Stack Web Development with Angular 6 an

Springfox Reference Documentation

1. Introduction The Springfox suite of java libraries are all about automating the generation of machine and human readable specifications for JSON APIs written using the spring family of projects. Springfox works by examining an application, once, a

JavaScript Patterns 2.12 Writing API Docs

Free and open source tools for doc generation: the JSDoc Toolkit (http://code.google.com/p/jsdoc-toolkit/) and YUIDoc (http://yuilibrary.com/projects/yuidoc). Process of generating API documentation ? Writing specially formatted code blocks ? Running

RESTful API的设计原则

最近一直在做公司的一个API平台的项目,前后大约有半年多了,中间穿插了好多其他的项目一起做的.上周经理要求写文档,我就重新打开项目开始检阅之前的代码,发现好多地方当初设计的并不合理,忽然就想到,一个好的API平台,应该怎么来设计呢?有哪些规范要遵守呢?面对自己的项目,感觉好多地方都要改,但是已经有人在用了,怎么办?全都要改动吗?所以就上网找解决方案,然后就发现一精品贴,现转载过来,以备不时查阅. 原文地址:http://www.cnblogs.com/moonz-wu/p/4211626.htm

【ASP.NET Web API教程】2.4 创建Web API的帮助页面

参考页面: http://www.yuanjiaocheng.net/CSharp/csharprumenshili.html http://www.yuanjiaocheng.net/entity/mode-first.html http://www.yuanjiaocheng.net/entity/database-first.html http://www.yuanjiaocheng.net/entity/choose-development-approach.html http://ww

Rewrite MSIL Code on the Fly with the .NET Framework Profiling API

.NET Internals Rewrite MSIL Code on the Fly with the .NET Framework Profiling API Aleksandr Mikunov This article assumes you're familiar with the CLR and C# Level of Difficulty 1 2 3 Code download available at: NETProfilingAPI.exe (2,901KB) SUMMARY I

Java Logging API - Tutorial

Java Logging This article describes how to use the Logging API in Java programs. It includes an example for creating an HTML logger. Table of Contents 1. Overview 1.1. Logging 1.2. Logging in Java 1.3. Create a logger 1.4. Level 1.5. Handler 1.6. For

API Design

REST API Design Guidelines V 1.0.201208 Draft 5 Last Updated: 08/31/2012 1       简介 本文档旨在规范REST API的设计和开发. 1.1      REST API目标 REST API允许Newegg内部和外部开发人员通过编程方式访问Newegg系统的各种对象与资源. REST API需最大限度地满足平台无关性. 2       REST基本原则 REST全称“Representational State Tr

Android M Developer Preview - API Preview(一)

API Overview The M Developer Preview gives you an advance look at the upcoming release for the Android platform, which offers new features for users and app developers. This document provides an introduction to the most notable APIs. 即将到来的Android平台的释