# TCGBTerms Class Reference

Inherits from | NSObject
Declared in | TCGBTerms.h

## Request Showing Terms View

### `+ showTermsViewWithViewController:completion:`

This is the method to request showing terms view. There is a viewController parameter and you may put your top most viewController. When finished showing terms view, this method calls completion.

`+ (void)showTermsViewWithViewController:(nullable UIViewController *)viewController completion:(nullable void ( ^ ) ( TCGBDataContainer *_Nullable dataContainer , TCGBError *_Nullable error ))completion`

#### Parameters

`viewController` | represent to current viewController
`completion` | completion may call when finished showing terms view. This callback has TCGBDataContainer information. If there is an error, TCGBError will be returned. ### Usage Example
    - (void)showTermsView {
        [TCGBTerms showTermsViewWithViewController:self completion:^(TCGBDataContainer *dataContainer, TCGBError *error) {
            if (error) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    NSLog(@"Error : %@", error);
                });
            } else {
                dispatch_async(dispatch_get_main_queue(), ^{
                    NSLog(@"Finish Terms View.");
                    if (dataContainer) {
                        // DataContainer can be converted to PushConfiguration.
                        TCGBPushConfiguration *configuration = [TCGBPushConfiguration fromDataContainer:dataContainer];
                    }
                });
            }
        }];
    }

#### Discussion

Request Showing terms view.

Warning: If viewController is nil, Terms view set it to top most view controller automatically.

#### Declared In

`TCGBTerms.h`

### `+ showTermsViewWithConfiguration:viewController:completion:`

This is the method to request showing terms view. There is a viewController parameter and you may put your top most viewController. When finished showing terms view, this method calls completion.

`+ (void)showTermsViewWithConfiguration:(TCGBTermsConfiguration *)configuration viewController:(nullable UIViewController *)viewController completion:(nullable void ( ^ ) ( TCGBDataContainer *_Nullable dataContainer , TCGBError *_Nullable error ))completion`

#### Parameters

`configuration` | This configuration is applied to the behavior of terms.
`viewController` | represent to current viewController
`completion` | completion may call when finished showing terms view. This callback has TCGBDataContainer information. If there is an error, TCGBError will be returned. ### Usage Example
    - (void)showTermsView {
        TCGBTermsConfiguration *configuration = [[TCGBTermsConfiguration alloc] init];
        [TCGBTerms showTermsViewWithConfiguration:configuration viewController:self completion:^(TCGBDataContainer *dataContainer, TCGBError *error) {
            if (error) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    NSLog(@"Error : %@", error);
                });
            } else {
                dispatch_async(dispatch_get_main_queue(), ^{
                    NSLog(@"Finish Terms View.");
                    if (dataContainer) {
                        // DataContainer can be converted to PushConfiguration.
                        TCGBPushConfiguration *configuration = [TCGBPushConfiguration fromDataContainer:dataContainer];
                    }
                });
            }
        }];
    }

#### Discussion

Request Showing terms view.

Warning: If viewController is nil, Terms view set it to top most view controller automatically.

#### Declared In

`TCGBTerms.h`

### `+ isShowingTermsView`

This is the method to check if terms view is being shown.

`+ (BOOL)isShowingTermsView`

#### Declared In

`TCGBTerms.h`

### `+ queryTermsWithViewController:completion:`

This is the method to query terms result to Gamebase Server. There is a viewController parameter and you may put your top most viewController.

`+ (void)queryTermsWithViewController:(nullable UIViewController *)viewController completion:(void ( ^ ) ( TCGBQueryTermsResult *_Nullable queryTermsResult , TCGBError *_Nullable error ))completion`

#### Parameters

`viewController` | represent to current viewController
`completion` | This callback has TCGBQueryTermsResult information.

#### Discussion

Query terms result to Gamebase Server.

#### See Also

- `

  TCGBQueryTermsResult

  ### Usage Example

      - (void)queryTerms {
          [TCGBTerms queryTermsWithViewController:self completion:^(TCGBQueryTermsResult *queryTermsResult, TCGBError *error) {
              if (error) {
                  dispatch_async(dispatch_get_main_queue(), ^{
                      NSLog(@"Error : %@", error);
                  });
              } else {
                  dispatch_async(dispatch_get_main_queue(), ^{
                      int termsSeq = queryTermsResult.termsSeq;
                      NSString *termsVersion = queryTermsResult.termsVersion;
                  });
              }
          }];
      }

  `

#### Declared In

`TCGBTerms.h`

### `+ updateTermsWithViewController:configuration:completion:`

This is the method to update terms information to Gamebase Server. There is a viewController parameter and you may put your top most viewController.

`+ (void)updateTermsWithViewController:(nullable UIViewController *)viewController configuration:(TCGBUpdateTermsConfiguration *)configuration completion:(nullable void ( ^ ) ( TCGBError *_Nullable error ))completion`

#### Parameters

`viewController` | represent to current viewController
`configuration` | The configuration which has user’s terms agreed information.
`completion` | completion may call when finished update terms information. If there is an error, TCGBError will be returned.

#### Discussion

Update terms information to Gamebase Server.

#### See Also

- `

  TCGBUpdateTermsConfiguration

  ### Usage Example

      - (void)updateTerms {
          TCGBTermsContent *termsContent = [TCGBTermsContent termsContentWithTermsContentSeq:12 agreed:YES];

          NSMutableArray *contents = [NSMutableArray array];
          [contents addObject:termsContent];

          TCGBUpdateTermsConfiguration *configuration = [TCGBUpdateTermsConfiguration configurationWithTermsVersion:@"1.2.3" termsSeq:1 contents:contents];

          [TCGBTerms updateTermsWithViewController:self configuration:configuration completion:^(TCGBError *error) {
              if (error) {
                  dispatch_async(dispatch_get_main_queue(), ^{
                      NSLog(@"Error : %@", error);
                  });
              } else {
                  dispatch_async(dispatch_get_main_queue(), ^{
                      NSLog(@"Update Terms Success");
                  });
              }
          }];
      }

  `

#### Declared In

`TCGBTerms.h`