---
# System prepended metadata

title: Guild_Method
tags: [API]

---

---
title: 'Guild_Method'
disqus: hackmd
tags: 'API'
---

## **Method**
## **CreateGuild**
***Create Guild***      

***• static void CreateGuild(CloudGame game, string name, string note, int maxmember, int permission, int tag, int G1, int G2, int G3, int G4, OnCallCompletionWithData cb, object token)***    
     
Create a guild and the creator is the guild's president.

| parameter     | note     |
|:------------------ |:------------ |
| name               | Guild’s name. The system has no limit to the guild’s names, and developers can filter out the restricted names according to their own needs. |
| note               | Guild’s description. |
| maxmember          | The maximum number of members the guild allows. (The maximum is 100)     |
| permission         | 0: Anyone can join the guild. / 1: Only guild managers or super users have the authorization to let players join the guild. / 2: No one can join. |
| tag                | Guild's tag.        |
| G1 ~ G4 guild registers | Guild registers for saving integer data defined by developers (such as guild levels, guild prizes, etc.). When calling functions that read the guild list such as `GetGuild()`, it is used to designate the sequence order. |
    
Types of back-sendings:
`void cb(int code, object obj, object token)`      
       
Here are the codes' status codes and their notes.    
          
| stastus code | note     |
|:------ |:---------------------- |
| 0      | the creation functions successfully      |
| not 0   |The creations fails and the code is the error code. obj is meaningless and negligible. |
       
obj	is cast as uint, which stores the guild's verification code.      
      
<mark>Please be aware that if developers set in the game management backstage that “regular users” do not have the authorization to create a guild, calling this function will fail. Developers have to use suCreateGuild() instead, and create a guild with the DP server logic program.</mark>  
        
## **DeleteGuild**
***Delete Guild***    
          
***• static void DeleteGuild(CloudGame game, OnCallCompletion cb, object token)***
                
This function is called by the guild’s president, and it’s only used to delete a guild that already exists.
 
Types of back-sendings:
`void cb(int code, object token)`      
       
Here are the codes' status codes and their notes.    
          
| stastus code | note     |
|:------ |:---------------------- |
| 0      | the deletion functions successfully      |
| not 0   |the deletion fails and the code is the error code |
      
       
Supplementary note:          
If the caller of this function does not have the authorization to delete the guild, callback cb() will send in a non-0 parameter code. 
       
## **JoinGuild**
***Join Guild***       
***• static void JoinGuild(CloudGame game, uint guildid, OnCallCompletion cb, object token)***        
        
Join a guild that already exists.

| parameter  | notes      |
|:------- |:-------------------- |
| guildid | the verification code of the guild one wants to join|

Types of back-sendings:
`void cb(int code, object token)`      

Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:---------------------- |
| 0      | the joining succeeds   |
| not 0   | the joining fails and the code is the error code |
        
Authorization description: The caller is a regular player (not the guild’s president or the manager) and the guild he wants to join has to set its permission as 0 when creating the guild, which means that anyone can join it.      
           
<mark>Please be aware that when guild members join the guild, each of them will have four registers, which are R1, R2, R3, and R4. They are used to store integer data, and developers can define their purposes, such as inputting member levels, life rates, etc. In the future, when obtaining the list of guild members, R1 ~ R4 can serve as filters.</mark>

In addition to inputting the registers’ values with `SetPlayerGuildRegister()`, the R1 ~ R4 registers can input the attribute data with `CloudItem.SetItemInstanceAttribute()` in the Rx register at the same time. For more information, please refer to `CloudItem.SetItemInstanceAttribute()`.
               
***• static void JoinGuild(CloudGame game, string userid, uint guildid, OnCallCompletion cb, object token)***     
        
Designate a player (userid) to join the guild. This function has to be calles by the guild's president or its managers.

| parameter | note  |
|:------- |:---------- |
| userid  | player's userid |
| guildid | the guild's verification code |
    
Please refer the callback to the previous overloading.          
        
## **LeaveGuild**
***Leave Guild***       
     
***• static void LeaveGuild(CloudGame game, OnCallCompletion cb, object token)***       
      
Leave the guild one currently participates in.         

Types of back-sendings:
`void cb(int code, object token)`         

Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the leave succeeds    |
| not 0   | the leave fails and the code is the error code |
          
Authorization description: The caller is a regular player (not the guild’s president or the managers).        
          
***• static void LeaveGuild(CloudGame game, string userid, OnCallCompletion cb, object token)***      
          
This function has to be called by the guild’s president or managers.If the designated player does not join the guild that the caller manages, cb will send back an error code.

| parameter  | note    |
|:------ |:------------------------- |
| userid | player's userid |
           
Please refer to the callback for the previous overloading.      
          
## **UpdateGuild** 
***Change Guild's Attribute Data***      
            
***• static void UpdateGuild(CloudGame game, string name, string note, object maxnumber, object permission, object tag, object G1, object G2, object G3, object G4, OnCallCompletionWithData cb, object token)***
        
Change guild's attribute data. This function has to be called by the guild's president or managers, or there will be an authorization error.

| parameter | note |
|:---- |:---- |
| name | Guild’s name. The system has no limit to the guild’s names, and developers can filter out the restricted names according to their own needs.|
| note | Guild’s description. |
| maxmember |  The maximum number of members the guild allows, and it has to be an integer. |
| permission |  0: Anyone can join the guild. / 1: Only guild managers or super users have the authorization to let players join the guild. / 2: No one can join.  |
| tag | Guild tag, which has to be an integer. |
| G1 ~ G4 guild registers | Save integer data defined by developers. When GetGuild() calls, it is used to designate the sequence order.|

(If the above parameters are set as null, it means the attribute data cannot be changed.)     
                
Types of back-sendings:         
`void cb(int code, object obj, object token)`      

Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the change succeeds   |
| not 0   | the change fails, the code is the error code, and obj is meaningless and negligible |
              
obj is cast as uint and stores the guild's verification code.        
             
## **GetGuild** 
***Read Guild List***      
        
The following are the definitions of all the functions:    
           
***• public static void GetGuild(CloudGame game, string orderby, int maxnumber, OnCallCompletionWithData cb, object token)***      
       
***• public static void GetGuild(CloudGame game, string orderby, int maxnumber, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***     
       
***• public static void GetGuild(CloudGame game, string orderby, int maxnumber, string RegisterCondition, OnCallCompletionWithData cb, object token)***     
      
***• public static void GetGuild(CloudGame game, string orderby, int maxnumber, string RegisterCondition, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***     

For further information, please go to Read Guild Notes below.
     
## **GetGuildByName**
***Read the List of Guilds (according to guilds’ names)***      
        
The following are the definitions of all the functions:    
           
***• public static void GetGuildByName(CloudGame game, string Name, string orderby, int maxnumber, OnCallCompletionWithData cb, object token)***     
     
***• public static void GetGuildByName(CloudGame game, string Name, string orderby, int maxnumber, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***     
        
***• public static void GetGuildByName(CloudGame game, string Name, string orderby, int maxnumber, string RegisterCondition, OnCallCompletionWithData cb, object token)***      
       
***• public static void GetGuildByName(CloudGame game, string Name, string orderby, int maxnumber, string RegisterCondition, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***      
       
For further information, please go to Read Guild Notes below.

## **GetGuildByPermission**
***Read the List of Guilds (according to guilds’ types)***      
        
The following are the definitions of all the functions:    
           
***• public static void GetGuildByPermission(CloudGame game, int permission, string orderby, int maxnumber, OnCallCompletionWithData cb, object token)***     
        
***• public static void GetGuildByPermission(CloudGame game, int permission, string orderby, int maxnumber, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***      
        
***• public static void GetGuildByPermission(CloudGame game, int permission, string orderby, int maxnumber, string RegisterCondition, OnCallCompletionWithData cb, object token)***        
         
***• public static void GetGuildByPermission(CloudGame game, int permission, string orderby, int maxnumber, string RegisterCondition, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***      
          
For further information, please go to Read Guild Notes below.

## **GetGuildByTag**
***Read the List of Guilds (according to guilds’ tags)***      
        
The following are the definitions of all the functions:    
           
***• public static void GetGuildByTag(CloudGame game, int tag, string orderby, int maxnumber, OnCallCompletionWithData cb, object token)***         
          
***• public static void GetGuildByTag(CloudGame game, int tag, string orderby, int maxnumber, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***        
      
***• public static void GetGuildByTag(CloudGame game, int tag, string orderby, int maxnumber, string RegisterCondition, OnCallCompletionWithData cb, object token)***         
           
***• public static void GetGuildByTag(CloudGame game, int tag, string orderby, int maxnumber, string RegisterCondition, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***        
            
For further information, please go to Read Guild Notes below.

## **Read Guild Notes**     

There are four types of functions that can read the guilds' lists, and each of them has several overloadings. Before looking up the functions’ prototype, we categorize them into the table below to understand their features:            
             
| function's name    |  based condition | based condition | sorting method | filtering condition (one of the two or both) | filtering condition (one of the two or both) |
|:-------------------- |:----------:|:----------:|:--------:|:--------------------------:|:--------------------------:|
|                      |  parameter  |  note  | sorting method |register conditional expression   |   the time the guild is created   |
| GetGuild             |     -      | none  |  sortby  |     RegisterCondition      |         Start, End         |
| GetGuildByName       |    name    |  guild’s name  |  sortby  |     RegisterCondition      |         Start, End         |
| GetGuildByPermission | permission | guild’s category |  sortby  |     RegisterCondition      |         Start, End         |
| GetGuildByTag        |    tag     |  guild’s tag |  sortby  |     RegisterCondition      |         Start, End         |
| GetGuildByUserid     |   userid | player'a userid | none  | none  | none |
     
Call parameter note:     

| paramter  | note           |
|:--------- |:---------------------------------- |
| Orderby   | Designate to rank with the registers' values and the time the guild is created. For further information, please go to Supplementary Notes (1).|
| MaxNumber | Desingate the maximum number of data that can be read. For further information, please go to Supplementary Notes (2).|
| RegisterCondition  | Designate the register conditions and send back the lists of guilds that meet the requirements. For further information, please go to Supplementary Notes (3). |
| Start     | List the guilds that are created later than this time. For further information, please go to Supplementary Notes (4).            |
| End       | List the guilds that are created earlier than this time. For further information, please go to Supplementary Notes (5).            |

Supplementary Notes:         

(1) Since there are four guild registers in total (developers can define them according to the need of their game. For further explanation, please refer to the description in `CreateGuild()`). In this number string, the usable Keywords are listed below, and suffix asc or desc can be added to illustrate the ascending or descending order. If the suffix is not designated, it will be preset as asc.         
　　　　　　　　　　　   
               
| item  | note |
|:----------:|:----------------:|
|     g1     |  set the order according to register G1’s value |
|     g2     |  set the order according to register G2’s value |
|     g3     |  set the order according to register G3’s value |
|     g4     |  set the order according to register G4’s value |
| createtime |  according to the time the guild is created  |
      
If one wants to use ”g1 desc” to designate several sorting conditions at the same time, please use “,” to separate different conditions, such as ”g1 asc,g3 desc, createtime desc.”     
          
<mark>(2) Please be aware that `GetGuildByName()` runs the keyword search according to the parameter “name,” and the one with the exact same name will be listed as the first one. Thus, if one only wants to get the guild with the exact same name, please set MaxNumber = 1.</mark>     
            
(3) The condition equation is an operational word string that is made up with ">," "<," "=," "&," "|", g1, g2, g3, g4, now-g1stamp, now-g2stamp, now-g3stamp, and now-g4stamp. Example: ((g1 > 3 & g1< 5) | (g3 = 3)) & (now-g1stamp>86400)”. In different overloading, this parameter is not always provided. If not, it means the register conditions are not filtered        
          
(4) In different overloading, this parameter is not always provided. If it is not provided or sends back a null value, there is no starting time.      
          
(5) In different overloading, this parameter is not always provided. If it is not provided or sends back a null value, there is no ending time.        
          
Types of back-sendings:        
`void cb(int code, object data, object token)`     
       
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | succeed to obtain guild's data |
| not 0   | fail to obtain guild's data, the code is the error code, and data is meaningless and negligible |    
    
<mark>Please be aware that if no guild that meets the requirement is found, the parameter code will remain 0 but the length of the List that is sent back is 0.</mark>

obj is cast as List<Hashtable> and stores guild's data. The Keys and Values that are in the Hashtable are:   
           
| Key          | Value        |
| ------------ | ------------ |
| guildid      | guild’s verification code |
| name         | guild’s name |
| note         | guild’s description |
| leader       | the nickname of the guild’s president |
| maxnumber    | the maximum number of members (players) the guild allows |
| playernumber | the current number of members (players) in the guild |
| tag          | guild’s tag |
| permission   | guild’s category 0: anyone can join / 1: can only join with the president’s or the manager’s permission / 2: no one can join |
| g1           |  register G1, developers can define the attribute |
| g2           |  register G2, developers can define the attribute |
| g3           |  register G3, developers can define the attribute |
| g4           |  register G4, developers can define the attribute |
| g1stamp      | the last time register G1 is changed |
| g2stamp      | the last time register G2 is changed |
| g3stamp      | the last time register G3 is changed |
| g4stamp      | the last time register G4 is changed |
| createtime   | the time the guild is created |
| applystate   |  the application status of the caller that applies to join this guild 0: Hasn’t applied yet or no data (Since the application is not kept permanently, it stays “no data” after deleting.) 1: Reviewing by the guild’s manager 2: Application accepted 3: Application turned down |
           
## **GetGuildMember**
***Read Guild Member***   
      
Here are the definitions for all the functions:    
           
***• static void GetGuildMember(CloudGame game, uint guildid, string orderby, OnCallCompletionWithData cb, object token)***      
     
***• static void GetGuildMember(CloudGame game, string orderby, OnCallCompletionWithData cb, object token)***          
        
***• static void GetGuildMember(CloudGame game, uint guildid, string orderby, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***
           
***• static void GetGuildMember(CloudGame game, string orderby, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***      
           
***• static void GetGuildMember(CloudGame game, uint guildid, string orderby, string RegisterCondition, OnCallCompletionWithData cb, object token)***       
        
***• static void GetGuildMember(CloudGame game, string orderby, string RegisterCondition, OnCallCompletionWithData cb, object token)***
        
***• static void GetGuildMember(CloudGame game, uint guildid, string orderby, string RegisterCondition, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***    
       
***• static void GetGuildMember(CloudGame game, string orderby, string RegisterCondition, DateTime Start, DateTime End, OnCallCompletionWithData cb, object token)***  
    
For further information, please go to Notes for GetGuildMember below.
     
## **Notes for GetGuildMember**  
    
The functions that get the guild’s member have several overloading, and the below is the description for the functions’ parameters:       

| parameter     | note                        |
|:---------------- |:----------------------------------------------- |
| guildid          | Designate the verification code of the guild one wants to get. For further information, please go to Supplementary Notes (1).   |
| orderby          | It is designated to set the order with the register’s value or the time the player joins the guild. For further information, please go to Supplementary Notes (2).|
| RegiterCondition | Designate the register conditions and send back the list of guilds that meet the requirements. For further information, please go to Supplementary Notes (3).|
| Start            | List the members who join the guilds later than this time. For further information, please go to Supplementary Notes (4). |
| End              | List the members who join the guilds earlier than this time. For further information, please go to Supplementary Notes (5). |
    
Supplementary Notes:         
(1) If it is not designated, it will send calling to the guild that the player who calls this function joins.  
    
(2) Since there are four guild registers in total (developers can define them according to the need of their game. For further explanation, please refer to the description in JoinGuild()). In this number string, the usable Keywords are listed below, and suffix asc or desc can be added to illustrate the ascending or descending order. If the suffix is not designated, it will be preset as asc.       
         
|  parameter   |   note   |
|:--------:|:----------------:|
|    r1    | set the order according to register R1’s value  |
|    r2    | set the order according to register R2’s value  |
|    r3    | set the order according to register R3’s value  |
|    r4    | set the order according to register R4’s value  |
| jointime | according to the time the player joins the guild |
     
Example: “r1 desc” If one wants to designate several sorting conditions at the same time, please use “,” to separate different conditions, such as ”r1 asc,r3 desc, jointime desc.”  
     
(3) The condition equation is an operational word string that is made up with >, <, =, &, |, r1, r2, r3, r4, now-r1stamp, now-r2stamp, now-r3stamp, and now-44stamp. Example: “((r1 > 3 & r1< 5) | (r3 = 3)) & (now-r1stamp>86400) ”. In different overloading, this parameter is not always provided. If not, it means the register conditions are not filtered
  
(4) In different overloading, this parameter is not always provided. If it is not provided or sends back a null value, there is no starting time.     
          
(5) In different overloading, this parameter is not always provided. If it is not provided or sends back a null value, there is no ending time.              
    
Types of back-sendings:  
`void cb(int code, object data, object token)`     
       
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:---------------------------------------------- |
| 0      | succeed to obtain guild data |
| not 0   | fail to obtain guild data, the code is the error code, and data is meaningless and negligible|    
    
<mark>Please be aware that if no guild that meets the requirement is found, the parameter code will remain 0 but the size of the List that is sent back is 0.</mark>

data, which is cast as List<Hashtable>, stores guild's data. The Keys and Values in the Hashtable are:             
         
| Key       | Value                                                     |
| --------- |:--------------------------------------------------------- |
| guildid   | guild’s verification code                        |
| userid    | player’s userid                                   |
| nickname  | player’s nickname                                      |
| online    | 0: player is not online poid not 0: the poid of the player online                     |
| privilege | member’s authorization in this guild, 0: regular member / 1: (privilege member) manager / 2: (privilege member) president |
| r1    	| register R1, developers can define the attribute |
| r2    	| register R2, developers can define the attribute |
| r3    	| register R3, developers can define the attribute |
| r4    	| register R4, developers can define the attribute |
| r1stamp   | the last time register R1 is changed |
| r2stamp   | the last time register R2 is changed |
| r3stamp   | the last time register R3 is changed |
| r4stamp   | the last time register R4 is changed |
| jointime  | the time that player joins the guild |
  
    
## **SetGuildManager**
***Set or Remove Guild Manager***   
    
***• static void SetGuildManager(CloudGame game, string userid, bool ismanager, OnCallCompletion cb, object token)***          
     
This function is called by the guild’s president, and it is only used to set or remove a player’s qualification as a manager in this guild.
    
| paramter | note                         |
|:---------:|:---------------------------------------------------- |
|  userid   | the player’s userid that needs to be set or removed the qualification as the guild’s manager |
| ismanager | true: set as guild manager / false: remove the qualification as the guild’s manager |
            
Types of back-sendings:        
`void cb(int code, object token)`     

Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the setting or removal succeeds |
| not 0   | the setting or removal fails, and the code is the error code |
         
Supplementary Note:                
When calling this function, if one is not authorized, callback cb() will send in a parameter code that is not 0.      
       
## **SetPlayerGuildRegister**
***Set Player’s Guild Register***  
    
***• static void SetPlayerGuildRegister(CloudGame game, object R1, object R2, object R3, object R4, OnCallCompletion cb, object token)***
     
Set designated memeber's (userid) guild registers. This function can only be called by the guild's president or manager, or an authorization error will be sent back. Parameters R1 ~ R4  correspond to the player’s registers R1 ~ R4 in the guild system. If one chooses not to set a certain register, sending null into the corresponding parameter will do.   
    
| parameter  | note           |
|:------:|:---------------------------------- |
| R1 ~ R4 | The registers that one wants to set. Have to be an integer. If choose not to set, send null. |
    
<mark>Please be aware that if players can set their own guild registers, the authorization needs to be turned on in the management backstage. Or else, only super users can complete the setting in DP.</mark>

Types of back-sendings:        
`void cb(int code, object token)`     

Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the setting succeeds |
| not 0   | the setting fails, and the code is the error code |

***• static void SetPlayerGuildRegister(CloudGame game, string userid, object R1, object R2, object R3, object R4, OnCallCompletion cb, object token)***
         
Set designated memeber's (userid) guild registers. This function can only be called by the guild's president or manager, or an authorization error will be sent back. Parameters R1 ~ R4  correspond to the player’s registers R1 ~ R4 in the guild system. If one chooses not to set a certain register, sending null into the corresponding parameter will do.
      
|  parameter | note              |
|:-------:|:---------------------------------------------- |
| userid  | the userid of the player whose registeri is set          |
| R1 ~ R4 | The registers that one wants to set. Have to be an integer. If choose not to set, send null.   |
    
<mark>Please be aware that if players can set their own guild registers, the authorization needs to be turned on in the management backstage. Or else, only super users can complete the setting in DP.</mark>

Types of back-sendings:        
`void cb(int code, object token)`     

Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the setting succeeds |
| not 0   | the setting fails, and the code is the error code |    
        
## **ApplyJoinGuild**
***Player Applies to Join Guild***     
    
***• static void ApplyJoinGuild(CloudGame game, uint guildid, OnCallCompletionWithData cb, object token)***
        
This function is called by regular players to bring up a request on joining the guild to its manager, which means handing in the application form to the guild’s president and manager. After that, the guild’s manager has to read the application form with `GetApplyJoinGuild()` and decide whether to agree or disagree with the application.
    
|  parameter  | note     |
|:-------:|:------------------------ |
| guildid | the verification code of the guild one wants to join |
         
Types of back-sendings:     
`void cb (int code, object data, object token)`       
     
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the submission succeeds |
| not 0   | the submission fails, the code is the error code, and data is meaningless and negligible |
    
<mark>Please be aware that when the submission is successful, the application is not yet. Successful application only happens after guild’s manager’s approval.</mark>
           
data, which is cast as uint, represents the application’s verification code   
   	 	
## **GetApplyJoinGuild**
***Read Application on Joining the Guild***           

***• static void GetApplyJoinGuild(CloudGame game, _ApplyType_ state, OnCallCompletionWithData cb, object token)***        
       
This function can only be called by the guild’s president or manager, and usually for designating parameter state as pending and reading applications that wait to be processed. If the guild’s president or manager wants to list the approved, rejected, or all the applications, state can send in the other three parameters.

| parameter | note          |
|:-----:|:----------------------------- |
| state | the application's status of the designated (`_ApplyType_`)|
    
Supplementary Note:
There are four enum values for _ApplyType_ :
    
| parameter  | note   |
|:-------:|:------ |
| pending | processinng |
| approve | approved |
| reject  | rejected |
|   all   | all  |
    
Code : 
    
```
    enum _ApplyType_ 
    { 
        pending = 1 ,
        approve = 2,
        reject = 3, 
        all = 0 
    }
```    

Types of back-sendings:                 
`void cb(int code, object data, object token)`    
    
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the approval succeeds |
| not 0   | the approval fails, the code is the error code, and data is meaningless and negligible | 
         
data, which is cast as List<Hashtable>, stores application's data. The Keys and Values in the Hashtable are:          
        
|    Key    | Value                                  |  Type  |
|:---------:|:-------------------------------------- |:------:|
|  applyid  | application’s verification code          |  int   |
| nickname  | applicant’s player nickname         | string |
|   state   | application’s status 1: processing 2: approved 3: rejected|  int   |
| applytime | the time the application is submitted      | string |
| timetodel | the time the application is expected to be deleted  | string |        
          
## **ApproveJoinGuild**
***Process Application for Guild***

There are two functions to deal with applications for joining the guild. One of them is for approving and the other is for rejecting.       
      
I. Approving         
***• static void ApproveJoinGuild(CloudGame game, int applyid, int KeepRecordDays, OnCallCompletion cb, object token)***          
    
| parameter  | note         |
|:--------------:|:---------------------------- |
|    applyid     | application’s verification code  |
| KeepRecordDays | the number of days that this application has to be kept after processing |
    
<mark>Please be aware that since applications also occupy space in the data storage quota the developers own, if one designates a longer save time, it will take up a bigger space. The desired days of keeping the record can be set as 0, and the application will be deleted immediately after finishing processing it.</mark>

Types of back-sendings:
`void cb(int code, object token)`     
    
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the approving succeeds |
| not 0   | the approving fails, and the code is the error code |
                 
***• static void ApproveJoinGuild(CloudGame game, uint guildid, int applyid, int KeepRecordDays, OnCallCompletion cb, object token)***        
           
|   parameter   | note   |
|:--------------:|:---------------------------- |
|    guildid     | guild’s verification code   |
|    applyid     | application’s verification code    |
| KeepRecordDays | the number of days that this application has to be kept after processing | 
    
<mark>Please be aware that since applications also occupy space in the data storage quota the developers own, if one designates a longer save time, it will take up a bigger space. The desired days of keeping the record can be set as 0, and the application will be deleted immediately after finishing processing it.</mark>        
                   
Types of back-sendings:
`void cb(int code, object token)`     
    
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the approving succeeds |
| not 0   | the approving fails, and the code is the error code |     
				 
II. Rejecting        
***• static void RejectJoinGuild(CloudGame game, int applyid, int keepday, OnCallCompletion cb, object token)***
         
| parameter  | note         |
|:--------------:|:---------------------------- |
|    applyid     | application’s verification code  |
| keepday | the number of days that this application has to be kept after processing |
    
<mark> Please be aware that since applications also occupy space in the data storage quota the developers own, if one designates a longer save time, it will take up a bigger space. The desired days of keeping the record can be set as 0, and the application will be deleted immediately after finishing processing it. Once the application is deleted, the player can fill in another one again. Thus, don’t set a too small number for days of keeping records.</mark>  

Types of back-sendings:
`void cb(int code, object token)`     
    
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the rejecting succeeds |
| not 0   | the rejecting fails, and the code is the error code |    
             
***• static void RejectJoinGuild(CloudGame game, uint guildid, int applyid, int keepday, OnCallCompletion cb, object token)***        
         
|   parameter   | note   |
|:--------------:|:---------------------------- |
|    guildid     | guild’s verification code   |
|    applyid     | application’s verification code    |
| keepday | the number of days that this application has to be kept after processing |
    
<mark>Please be aware that since applications also occupy space in the data storage quota the developers own, if one designates a longer save time, it will take up a bigger space. The desired days of keeping the record can be set as 0, and the application will be deleted immediately after finishing processing it. Once the application is deleted, the player can fill in another one again. Thus, don’t set a too small number for days of keeping records.</mark>           

Types of back-sendings:
`void cb(int code, object token)`     
    
Here are the codes' status codes and their notes.    
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the rejecting succeeds |
| not 0   | the rejecting fails, and the code is the error code | 
           
## **GetGuildByUserid**
***Get Guild List with Userid***
       
***• public static void GetGuildByUserid(CloudGame game, string userid, OnCallCompletionWithData cb, object token)***        
        
Not searching with keywords, so only the guilds the player joins are listed.
  
| paramter  | note   |
|:------:|:---------- |
|  game  | the logged-in game  |
| userid | player’s account |

Types of back-sendings:           
`void cb(int code, object data, object token)`       

Here are the codes' status codes and their notes.  
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the reading succeeds |
| not 0   | the reading fails, the code is the error code, and data is meaningless and negligible |

Supplementary Note:
If no guild that meets the requirements is found, the parameter will still be 0, and the size of the List that sends back will be 0.   

data, which is cast as List<Hashtable>, stores guild's data. The Keys and Values in the Hashtable are:
           
| Key          | Value |
| ------------ | ------------ |
| guildid      | guild’s verification code  |
| name         | guild’s name |
| note         | guild’s note |
| leader       | the nickname of the guild’s president |
| maxnumber    | the maximum number of members (players) the guild allows |
| playernumber | the current number of members (players) in the guild |
| tag          | guild’s tag |
| permission   | guild’s category 0: anyone can join / 1: can only join with the president’s or the manager’s permission / 2: no one can join |
| g1           | register G1, developers can define the attribute |
| g2           | register G2, developers can define the attribute |
| g3           | register G3, developers can define the attribute |
| g4           | register G4, developers can define the attribute |
| g1stamp      | the last time register G1 is changed |
| g2stamp      | the last time register G2 is changed |
| g3stamp      | the last time register G3 is changed |
| g4stamp      | the last time register G4 is changed |
| createtime   | the time the guild is created |
| applystate   | The application status of the caller that applies to join this guild. 0: Hasn’t applied yet or no data (Since the application is not kept permanently, it stays “no data” after deleting.) / 1: Reviewing by the guild’s manager / 2: Application accepted / 3: Application turned down |  
         
## **GetGuildById**
***Get Guild List with Guildid***
     
***• public static void GetGuildById(CloudGame game, uint guildid, OnCallCompletionWithData cb, object token)***        
    
Not searching with keywords, so only the guilds the player joins are listed.
  
| paramter  | note   |
|:------:|:---------- |
|  game  | the logged-in game  |
| guildid | guild's verification code |

Types of back-sendings:           
`void cb(int code, object data, object token)`       

Here are the codes' status codes and their notes.  
          
| status code| note       |
|:------ |:-------------------------- |
| 0      | the obtaining succeeds |
| not 0   | the obtaining fails, the code is the error code, and data is meaningless and negligible |

Supplementary Note:
If no guild that meets the requirements is found, the parameter will still be 0, and the size of the List that sends back will be 0.
		  
data, which is cast as List<Hashtable>, stores guild's data. The Keys and Values in the Hashtable are:      

| Key          | description for data columns |
| ------------ | ------------ |
| guildid      | guild’s verification code   |
| name         | guild’s name |
| note         | guild’s note |
| leader       | the nickname of the guild’s president |
| maxnumber    | the maximum number of members (players) the guild allows |
| playernumber | the current number of members (players) in the guild  |
| tag          | guild’s tag |
| permission   | guild’s category 0: anyone can join / 1: can only join with the president’s or the manager’s permission / 2: no one can join |
| g1           | register G1, developers can define the attribute |
| g2           | register G2, developers can define the attribute |
| g3           | register G3, developers can define the attribute |
| g4           | register G4, developers can define the attribute |
| g1stamp      | the last time register G1 is changed |
| g2stamp      | the last time register G2 is changed |
| g3stamp      | the last time register G3 is changed |
| g4stamp      | the last time register G4 is changed |
| createtime   | the time the guild is created |
| applystate   | The application status of the caller that applies to join this guild. 0: Hasn’t applied yet or no data (Since the application is not kept permanently, it stays “no data” after deleting.) / 1: Reviewing by the guild’s manager / 2: Application accepted / 3: Application turned down |


