net.accelbyte.sdk.api.challenge.operations.challenge_progression.PublicGetPastUserProgression Maven / Gradle / Ivy
Show all versions of module-challenge Show documentation
/*
* Copyright (c) 2024 AccelByte Inc. All Rights Reserved
* This is licensed software from AccelByte Inc, for limitations
* and restrictions contact your company contract manager.
*
* Code generated. DO NOT EDIT.
*/
package net.accelbyte.sdk.api.challenge.operations.challenge_progression;
import java.io.*;
import java.util.*;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import net.accelbyte.sdk.api.challenge.models.*;
import net.accelbyte.sdk.core.HttpResponseException;
import net.accelbyte.sdk.core.Operation;
import net.accelbyte.sdk.core.util.Helper;
/**
* publicGetPastUserProgression
*
* * Required permission: NAMESPACE:{namespace}:CHALLENGE:PROGRESSION [READ]
*/
@Getter
@Setter
public class PublicGetPastUserProgression extends Operation {
/** generated field's value */
private String path =
"/challenge/v1/public/namespaces/{namespace}/users/me/progress/{challengeCode}/index/{index}";
private String method = "GET";
private List consumes = Arrays.asList();
private List produces = Arrays.asList("application/json");
private String locationQuery = null;
/** fields as input parameter */
private String challengeCode;
private Integer index;
private String namespace;
private String goalCode;
private Integer limit;
private Integer offset;
private List tags;
/**
* @param challengeCode required
* @param index required
* @param namespace required
*/
@Builder
// @deprecated 2022-08-29 - All args constructor may cause problems. Use builder instead.
@Deprecated
public PublicGetPastUserProgression(
String customBasePath,
String challengeCode,
Integer index,
String namespace,
String goalCode,
Integer limit,
Integer offset,
List tags) {
this.challengeCode = challengeCode;
this.index = index;
this.namespace = namespace;
this.goalCode = goalCode;
this.limit = limit;
this.offset = offset;
this.tags = tags;
super.customBasePath = customBasePath != null ? customBasePath : "";
securities.add("Bearer");
}
@Override
public Map getPathParams() {
Map pathParams = new HashMap<>();
if (this.challengeCode != null) {
pathParams.put("challengeCode", this.challengeCode);
}
if (this.index != null) {
pathParams.put("index", this.index == null ? null : String.valueOf(this.index));
}
if (this.namespace != null) {
pathParams.put("namespace", this.namespace);
}
return pathParams;
}
@Override
public Map> getQueryParams() {
Map> queryParams = new HashMap<>();
queryParams.put("goalCode", this.goalCode == null ? null : Arrays.asList(this.goalCode));
queryParams.put("limit", this.limit == null ? null : Arrays.asList(String.valueOf(this.limit)));
queryParams.put(
"offset", this.offset == null ? null : Arrays.asList(String.valueOf(this.offset)));
queryParams.put("tags", this.tags == null ? null : this.tags);
return queryParams;
}
@Override
public boolean isValid() {
if (this.challengeCode == null) {
return false;
}
if (this.index == null) {
return false;
}
if (this.namespace == null) {
return false;
}
return true;
}
public ModelUserProgressionResponse parseResponse(
int code, String contentType, InputStream payload) throws HttpResponseException, IOException {
if (code != 200) {
final String json = Helper.convertInputStreamToString(payload);
throw new HttpResponseException(code, json);
}
final String json = Helper.convertInputStreamToString(payload);
return new ModelUserProgressionResponse().createFromJson(json);
}
@Override
protected Map getCollectionFormatMap() {
Map result = new HashMap<>();
result.put("goalCode", "None");
result.put("limit", "None");
result.put("offset", "None");
result.put("tags", "csv");
return result;
}
}